-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
73 lines (66 loc) · 2.2 KB
/
signup.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
<?php require "header.php" ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Signup</title>
</head>
<body>
<?php
# Error msg generator
$holderUsername = "Username";
$holderUsernameError = "john_doe";
$holderMail = "E-mail";
$holderMailError = "[email protected]";
$msg = "";
if (isset($_GET["error"])) {
switch ($_GET["error"]) {
case 'empty':
$holderUsername = $holderUsernameError;
$holderMail = $holderMailError;
break;
case 'invalidEmail/uid':
$holderUsername = $holderUsernameError;
$holderMail = $holderMailError;
break;
case 'invalidEmail':
$holderMail = $holderMailError;
break;
case 'invalidUid':
$holderUsername = $holderUsernameError;
break;
case 'passwordCheck':
$msg = "The passwords do not correspond. Try again.";
break;
case 'uidTaken':
$msg = "The username is alreaty taken. Choose another.";
break;
}
}
?>
<h1>Signup</h1>
<form action="includes/signup.inc.php" method="post">
<?php
if (isset($_GET["uid"])) {
echo '<input type="text" name="uid" value="' . $_GET["uid"] . '"><br>';
} else {
echo '<input type="text" name="uid" placeholder="' . $holderUsername . '"><br>';
} ?>
<?php
if (isset($_GET["mail"])) {
echo '<input type="text" name="mail" value="' . $_GET["mail"] . '"><br>';
} else {
echo '<input type="text" name="mail" placeholder="' . $holderMail . '"><br>';
} ?>
<input type="password" name="pwd" placeholder="Password"><br>
<input type="password" name="pwd2" placeholder="Repeat password">
<button type="submit" name="signup-submit">Signup</button>
<?php
echo $msg;
?>
</form>
</body>
</html>
<?php require "footer.php" ?>