2021-10-11 13:33:10 +00:00
< ? php
include ( " /var/www/tilde.cafe/inc/header.html " );
if ( $_POST == array ()){
?>
< p > We ' ll contact you when your account is ready .< br />
2021-11-12 00:33:02 +00:00
Don ' t want to use email ? contact an admin directly < br />
we ' re available on IRC at < a href = " ircs://irc.libera.chat:6697/tilde.cafe " > #tilde.cafe on libera.chat</a> and <a href="ircs://irc.tilde.chat:6697/cafe">#cafe on tilde.chat</a>).</p>
2021-10-11 13:33:10 +00:00
< form method = " post " >
< p > Username :</ p >
< input type = " text " name = " username " required = " required " maxlength = " 20 " width = " 20ch " pattern = " [a-z][-0-9a-z_] { 2,} " placeholder = " MyUserName " />< br />
< p > E - mail :</ p >
< input style = " max-width:100% " type = " email " name = " email " required = " required " minlength = " 7 " maxlength = " 30 " size = " 30 " placeholder = " email@example.com " />< br />
< p > SSH < em > public </ em > key ( don ' t have one ? check our < a href = " https://tilde.cafe/wiki/ssh " > wiki </ a > ) :< p >
<!-- maximum length of 400 should allow even 4096 - bit rsa keys , with a short comment , more than that is ridiculous -->
< input style = " max-width:100% " type = " text " name = " sshkey " required = " required " pattern = " ssh-(rsa|(ed25519|ecdsa)(-sk)?) [0-9a-zA-Z+/=] { 60,}( .*)? " size = " 100 " placeholder = " ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA MyUserName@home_pc " />< br />
< p > Reason ( why do you want / need an account ? ) :</ p >< textarea cols = " 70 " rows = " 2 " name = " reason " maxlength = " 140 " required = " required " ></ textarea >< br />
2021-11-12 00:33:02 +00:00
< br />
< label > I am at least 13 years old , and agree to follow the < a href = " https://tilde.cafe/wiki/code-of-conduct " target = " _blank " > Code of Conduct </ a >: < input type = " checkbox " value = " legal " /></ label >< br />
< br />
2021-10-11 13:33:10 +00:00
< input type = " submit " value = " Sign Up " />
</ form >
< ? php
} else {
2021-11-12 00:33:02 +00:00
$username = $_POST [ " username " ]; $email = $_POST [ " email " ]; $reason = $_POST [ " reason " ]; $sshkey = $_POST [ " sshkey " ]; $legal = $_POST [ " legal " ];
2021-10-11 13:33:10 +00:00
$nl = " \r \n " ;
2021-10-11 13:58:50 +00:00
$makeuser = " makeuser " . $username . " " . $email . " \" " . $sshkey . " \" " ;
$message = " username: " . $username . $nl . " email: " . $email . $nl . " reason: " . $reason . $nl . $nl . $makeuser ;
2021-12-08 17:17:06 +00:00
$sent = mail ( " sudoers@tilde.cafe " , " new tilde.cafe signup: $username " , $message , " From: signup " );
2021-10-11 13:33:10 +00:00
if ( $sent != True ){
print ( " error: signup failed to send! " );
} else {
print ( " Signup sent! (signups are usually accepted within 48 hours) " );
2021-10-11 13:58:50 +00:00
if ( file_exists ( " /var/signups " ) and is_writable ( " /var/signups " )){
$varsignups = fopen ( " /var/signups " , " a " );
fwrite ( $varsignups , $makeuser . " \n " );
fclose ( $varsignups );
};
2021-10-11 13:33:10 +00:00
};
};
include ( " /var/www/tilde.cafe/inc/footer.html " );
?>