site/public_html/signup.php

84 lines
3.5 KiB
PHP
Executable File

<?php
if (isset($_POST["signup"]) && isset($_POST["iamhuman"])) {
$file = "/var/www/tilde.center/public_html/requests/requests.txt";
echo getcwd() . "<br>";
echo file_exists($file) . "<br>";
$username = $_POST["username"];
$email = $_POST["email"];
$sshkey = $_POST["sshkey"];
$interest = $_POST["interest"];
$requests = fopen($file, "a") or die("[ERROR]: Cannot save request");
$data = $username . "\n" . $email . "\n" . $sshkey . "\n" . $interest . "\n----\n";
fwrite($requests, $data);
fclose($requests);
header("Location: /?signed=1");
exit();
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="tilde.center, a public unix group focused around decentralization, federation, and home-brewed open source projects">
<meta name="author" content="Austin Ewens, ~aewens">
<meta name="theme-color" content="#778899">
<link rel="canonical" href="https://tilde.center">
<title>Sign Up | tilde.center</title>
<link rel="stylesheet" type="text/css" href="https://tilde.center/css/style.css">
</head>
<body>
<main>
<header>
<pre>
_ _ _ _ _
| |_(_) | __| | ___ ___ ___ _ __ | |_ ___ _ __
| __| | |/ _` |/ _ \ / __/ _ \ '_ \| __/ _ \ '__|
| |_| | | (_| | __/| (_| __/ | | | || __/ |
\__|_|_|\__,_|\___(_)___\___|_| |_|\__\___|_|
</pre>
</header>
</main>
<form class="signup" action="signup.php" method="post">
<h1>Sign Up</h1>
<p>Fill out this form and you will get an email with your account information (within 24 hours)</p>
<label>Desired username (alphanumeric)</label><br>
<input type="text" name="username" pattern="[a-z0-9]+" required>
<label>Contact email (for sending account info)</label><br>
<input type="email" name="email" required>
<label>SSH public key*</label><br>
<textarea name="sshkey" rows="5" required></textarea>
<label>Why did you want to join?</label><br>
<textarea name="interest" rows="5"></textarea>
<button id="submit" type="submit" name="signup">Submit</button>
<p>* If you do not have an SSH public key, you can create one using:</p>
<pre>$ ssh-keygen -t rsa</pre>
<pre># press enter to all</pre>
<pre>$ cat ~/.ssh/id_rsa.pub</pre>
<pre># ^-- this is your SSH public key</pre>
</form>
<nav class="left">
<span><a href="index.php">return home</a></span>
</nav>
</body>
<script>
var br = document.createElement("br"),
humanTest = document.createElement("input"),
humanLabel = document.createElement("label"),
submitButton = document.getElementById("submit"),
parentNode = submitButton.parentNode;
humanLabel.innerHTML = "Are you human? ";
humanTest.setAttribute("type", "checkbox");
humanTest.setAttribute("name", "iamhuman");
humanTest.setAttribute("required", "required");
parentNode.insertBefore(br, submitButton);
parentNode.insertBefore(humanTest, br);
parentNode.insertBefore(humanLabel, humanTest);
</script>
</html>