please fill in your desired username";
if (strlen($name) > 32)
$message .= "
username too long (32 character max)";
if (!preg_match('/^[a-z][a-z0-9]{1,31}$/', $name))
$message .= "username contains invalid characters (lowercase ascii only, must start with a letter)";
if ($_REQUEST["sshkey"] == "" || mb_substr($_REQUEST["sshkey"], 0, 4) !== "ssh-")
$message .= 'ssh key required: please create one and submit the public key.';
if ($_REQUEST["interest"] == "")
$message .= "please explain why you're interested so we can make sure you're a real human being";
if (posix_getpwnam($name) || forbidden_name($name))
$message .= "sorry, the username $name is unavailable";
// Check the e-mail address.
$email = trim($_REQUEST["email"]);
if ($email == "")
$message .= "please fill in your email address";
else {
$result = SMTP::MakeValidEmailAddress($_REQUEST["email"]);
if (!$result["success"])
$message .= "invalid email address: " . htmlspecialchars($result["error"]) . "";
elseif ($result["email"] != $email)
$message .= "invalid email address. did you mean: " . htmlspecialchars($result["email"]) . "";
}
// no validation errors
if ($message == "") {
$sshkey = trim($_REQUEST["sshkey"]);
$makeuser = "makeuser {$_REQUEST["username"]} {$_REQUEST["email"]} \"{$sshkey}\"";
$msgbody = "
username: {$_REQUEST["username"]}
email: {$_REQUEST["email"]}
reason: {$_REQUEST["interest"]}
$makeuser
";
if (mail('fen', 'new tilde.pw signup', $msgbody)) {
echo '
email sent! we\'ll get back to you soon (usually within a day) with login instructions! back to tilde.pw
';
file_put_contents("/var/signups", $makeuser.PHP_EOL, FILE_APPEND);
} else {
echo '
something went wrong... please send an email to sudo@tilde.pw with details of what happened
';
}
} else {
?>
please correct the following errors:
=$message?>