-
Notifications
You must be signed in to change notification settings - Fork 3
/
register.php
executable file
·88 lines (61 loc) · 2.52 KB
/
register.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
require 'config.php';
header("Location: ".$config['base_url']."login.php");
// Code execution stops here.
// nothing below here matters anymore.
// - Gavin
die();
include("includes/bootstrap.inc");
connect();
$msg = "Wait a second...How'd I get here? Oh yea, I'm not allowed to see that page.";
$encode = urlencode($msg);
header("Location: http://www.ethanwilder.com/displaymsg.php?msg=$encode");
die();
/* Login form filled out */
if(isset($_POST['username'])) {
if(validateForm($_POST)) {
if(checkForUser($_POST['username'])) { //username is available
if(checkGoodPassword($_POST['password'])) { //password is acceptable
addUser($_POST['username'], $_POST['password'], $_POST['bcp'], $_POST['institute'], $_POST['name'], $_POST['email']);
$error = "You have successfully registered $_POST[username]. You can now <a href=\"login.php\">login</a> to THT";
}
else {
$error = "Your Password must be at least 6 characters and contain at least 1 non-alphanumeric character.";
}
}
else {
$error = "Sorry but that username is already taken. Please try a different name.";
}
}
else {
$error = "You must fill in all of the fields and provide a valid e-mail address. <br /> Example: [email protected]";
}
}
include("theme/header.php");
?>
<br />
<div class="box">
<h2>Registration</h2>
<p class="error"><?php echo $error; ?></p>
<form action="register.php" method="post">
<p><strong>Login Information:</strong></p>
<p>Username: <input type="text" name="username" /></p>
<p>Password: <input type="password" name="password" /></p>
<p><strong>General Information:</strong></p>
<p>Your Name: <input type="text" name="name" /></p>
<p>Your Email: <input type="text" name="email" /></p>
<p>Institute: <select name="institute">
<option value="Select">Select</option>
<?php showTableOptions("institutions"); ?>
</select></p>
<p>Are you part of the Barley CAP Project?: <br />
<input type="radio" name="bcp" value="100" /> Yes <br />
<input type="radio" name="bcp" value="101" checked="checked" /> No <br /></p>
<p><input type="submit" value="Register!" /> <input type="reset" value="Start Over" /></p>
</form>
</div>
<center>
<p>For general public access to THT, please visit <a href="http://hordeumtoolbox.org">hordeumtoolbox.org</a></p>
<p><strong>Note:</strong> This site uses cookies and requires cookies to be enabled.</p>
</center>
<?php include("theme/footer.php"); ?>