-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
80 lines (64 loc) · 2.73 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
<!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">
<link rel="stylesheet" href="register.css">
<title>Register</title>
</head>
<body>
<div class="container">
<div class="box form-box">
<div class="signUpImage">
<img src="images/signup.jpg" alt="">
</div>
<?php
include("php/config.php");
if(isset($_POST['submit'])){
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
//verifying the unique email
$verify_query = mysqli_query($conn,"SELECT email FROM userreg WHERE email='$email'");
if(mysqli_num_rows($verify_query) !=0 ){
echo "<div class='message'>
<p>This email is used, Try another One Please!</p>
</div> <br>";
echo "<a href='javascript:self.history.back()'><button class='btn'>Go Back</button></a>";
}
else{
mysqli_query($conn,"INSERT INTO userreg(username,email,password) VALUES('$username','$email','$password')") or die("Error Occured");
echo "<div class='message'>
<p>Registration successfully!</p>
</div> <br>";
echo "<a href='login.php'><button class='btn'>Login Now</button></a>";
}
}else{
?>
<header>Sign Up</header>
<form action="" method="post">
<div class="field input">
<label for="username">Username</label>
<input type="text" name="username" id="username" required>
</div>
<div class="field input">
<label for="email">Email</label>
<input type="text" name="email" id="email" autocomplete="off" required>
</div>
<div class="field input">
<label for="password">Password</label>
<input type="password" name="password" id="password" autocomplete="off" required>
</div>
<div class="field">
<input type="submit" class="btn" name="submit" value="Register" required>
</div>
<div class="links">
Already a member? <a href="login.php">Sign In</a>
</div>
</form>
</div>
<?php } ?>
</div>
</body>
</html>