-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
74 lines (71 loc) · 3.37 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
74
<?php
include 'includes/mysql-inc.php'; //include the data connection files
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>signup</title>
<link rel="stylesheet" href="./css/styes.css">
</head>
<body>
<!--form tag - Pass the user account info to the upload-user.php script by post method
input tag (name = "Fname" & type = "text") - Take the user's First name
input tag (name = "Sname" & type = "text") - Take the user's Last name
input tag (name = "email" & type = "text") - Take the user's email
input tag (name = "username" & type = "text") - Take the user's username
input tag (name = "pwd" & type = "text") - Take the user's password
input tag (name = "pwd" & type = "text") - Take the user's confirm password
button tag (name = "login" & type = sumbit) - Sumbit the user account info input by user to the location that form tag pointed to-->
<form action="./includes/upload-user.php" method="post">
<?php
/**
* check does the user enter an incorrect format, if so, clear those information, only leave
* correct one in the input box
*/
if(!isset($_GET['Fname'])){
echo '<input type="text" name="Fname" id="Fname" placeholder="First name"><br>
<input type="text" name="Sname" id="Sname" placeholder="Last name"><br>';
}else{
echo '<input type="text" name="Fname" id="Fname" placeholder="First name" value = "'.$_GET['Fname'].'"><br>
<input type="text" name="Sname" id="Sname" placeholder="Last name" value = "'.$_GET['Sname'].'"><br>';
}
if(!isset($_GET['email'])){
echo '<input type="email" name="email" id="email" placeholder="email"><br>';
}else{
echo '<input type="email" name="email" id="email" placeholder="email" value = "'.$_GET['email'].'"><br>';
}
if(!isset($_GET['username'])){
echo '<input type="text" name="username" id="username" placeholder="username"><br>';
}else{
echo '<input type="text" name="username" id="username" placeholder="username" value = "'.$_GET['username'].'"><br>';
}
?>
<input type="password" name="pwd" id="pwd" placeholder="password">
<input type="password" name="vpwd" id="vpwd" placeholder="confirm password">
<br>
<button type="submit" name = "submit" value="submit" >submit</button>
</form>
<?php
/**
* Information pass back by the upload-user.php script,
* check does the user signup successful or not
*/
if(isset($_GET['signup'])){
$check = $_GET['signup'];
if($check === "seccess"){
echo '<script>alert("seccess signup")</script>';
}elseif($check === "unseccsess"){
echo '<script>alert("something went round! please signup later")</script>';
}elseif($check === "username_error"){
echo '<script>alert("username_taking")</script>';
}
}
?>
<a href="./login.php">Go Login</a>
<br>
<a href="./index.php">Go to the home page</a>
</body>
</html>