-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistration.php
68 lines (67 loc) · 2.28 KB
/
registration.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
<?php
require 'config.php';
if(!empty($_SESSION["id"])){
header("Location: index.php");
}
if(isset($_POST["submit"])){
$name = $_POST["name"];
$username = $_POST["username"];
$email = $_POST["email"];
$password = $_POST["password"];
$confirmpassword = $_POST["confirmpassword"];
$duplicate = mysqli_query($conn, "SELECT * FROM tb_user WHERE username = '$username' OR email = '$email'");
if(mysqli_num_rows($duplicate) > 0){
echo
"<script> alert('Username or Email Has Already Taken'); </script>";
}
else{
if($password == $confirmpassword){
$query = "INSERT INTO tb_user VALUES('','$name','$username','$email','$password')";
mysqli_query($conn, $query);
echo
"<script> alert('Registration Successful'); </script>";
}
else{
echo
"<script> alert('Password Does Not Match'); </script>";
}
}
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<title>Registration</title>
</head>
<body>
<div class="menu-container">
<div class="logo">
<img src="logo.png" alt="Logo">
</div>
<ul class="menu">
<li><a href="/mazdoor/index.php">Home</a></li>
<li><a href="/mazdoor/viewpost.php">Jobs</a></li>
<li><a href="/mazdoor/createpost.php">Hire</a></li>
<li><a href="/mazdoor/logout.php">Logout</a></li>
</ul>
</div>
<div class="login-container">
<form class="" action="" method="post" autocomplete="off">
<label for="name">Name : </label>
<input type="text" name="name" id = "name" required value=""> <br>
<label for="username">Username : </label>
<input type="text" name="username" id = "username" required value=""> <br>
<label for="email">Email : </label>
<input type="email" name="email" id = "email" required value=""> <br>
<label for="password">Password : </label>
<input type="password" name="password" id = "password" required value=""> <br>
<label for="confirmpassword">Confirm Password : </label>
<input type="password" name="confirmpassword" id = "confirmpassword" required value=""> <br>
<button type="submit" class="btn" name="submit">Register</button>
</form>
<br>
<a href="login.php">Login</a>
</body>
</html>