forked from nik1097/MeTube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
74 lines (63 loc) · 2.34 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
require_once("files/connection.php");
require_once("files/Classes/UserAccount.php");
require_once("files/Classes/StatusMessage.php");
$userAccount = new UserAccount($con);
if(isset($_POST["signupButton"])){
$email = trim($_POST["email"]);
$userName = trim($_POST["username"]);
$password = $_POST["password"];
$confirmPassword = $_POST["confirmpassword"];
$resultKey=$userAccount->register($email,$password,$confirmPassword,$userName);
if($resultKey){
echo "Success";
header("location:index.php");
}
else{
echo "failure";
}
echo $email;
echo $password;
echo $confirmPassword;
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="container">
<div class="title">Join MeTube</div>
<h4>or <a href="login.php">sign in!</a></h4>
<div class="content">
<form action="signup.php" method="POST">
<div class="user-details">
<div class="input-box">
<input type="text" name="username" placeholder="Enter username" required>
<?php echo $userAccount->displayError(StatusMessage::$userNameUniqueError); ?>
</div>
<div class="input-box">
<input type="text" name = "email" placeholder="Enter email" required>
<?php echo $userAccount->displayError(StatusMessage::$emailInvalidError); ?>
<?php echo $userAccount->displayError(StatusMessage::$emailUniqueError); ?>
</div>
<div class="input-box">
<input type="password" name ="password" placeholder="Enter password" required>
</div>
<div class="input-box">
<input type="password" name = "confirmpassword" placeholder="Confirm password" required>
<?php echo $userAccount->displayError(StatusMessage::$passwordMatchError); ?>
<?php echo $userAccount->displayError(StatusMessage::$passwordLengthError); ?>
</div>
</div>
<div class="button">
<button type="submit" name="signupButton">Register</button>
</div>
</form>
</div>
</div>
</body>
</html>