site/signup/index.php

40 lines
1.6 KiB
PHP

<?php include 'header.php' ?>
<?php if($_POST==array()){ ?>
<p>Please fill in this form in order to register</p>
<p>We will contact you when your account is ready</p>
<p>If you can't or don't want to use form, contact us directly via <a href="mailto:root@hextilde.xyz">email</a> or g1n or r1k on <a href="/wiki/irc.php">IRC</a></p>
<hr>
<br>
<form id="signup" method="POST">
<label>Username:</label> <input name="username" type="text" required="required"/><br>
<br>
<label>Email to contact you when your account is ready:</label> <input name="email" type="email" required="required"/><br>
<br>
<label>SSH Public Key:</label><br>
<br>
<textarea name="sshkey" style="width:500px; height:50px" required="required"></textarea>
<br><br>
<label>Reason for joining and how you found us (so we can make sure that you are not a robot):</label><br>
<br>
<textarea name="reason" style="width:500px; height:100px" required="required"></textarea>
<br>
<br>
<input name="submit" type="submit" value="Submit"/>
</form>
<?php
} else {
$username=$_POST["username"];
$email=$_POST["email"];
$sshkey=$_POST["sshkey"];
$reason=$_POST["reason"];
$body = "Username: $username\nEmail: $email\nSSH-key:\n\n$sshkey\n\nReason:\n\n$reason\n\nNow please run this command, if application is valid:\n\nmakeuser $username $email \"$sshkey\"";
if (mail("root@hextilde.xyz", "New user request", $body)) {
echo "<p>Submitted! We will contact you when your account is ready</p>";
} else {
echo "<p>Error occured, please contact us via root@hextilde.xyz or on irc";
}
}
?>
<br>
<?php include 'footer.php' ?>