-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
91 lines (75 loc) · 2.46 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
$success=0;
$user=0;
if($_SERVER['REQUEST_METHOD']=='POST'){
include 'connect.php';
$employeeID=$_POST['employeeID'];
$password=$_POST['password'];
$sql="SELECT*from employee_t where employeeID='$employeeID'";
$result=mysqli_query($con,$sql);
if($result){
$num=mysqli_num_rows($result);
if($num>0){
$user=1;
}
else{
$sql="insert into employee_t (employeeID,password)
values('$employeeID','$password')";
$result=mysqli_query($con,$sql);
if($result){
$success=1;
}
else{
die(mysqli_error($con));
}
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title>Signup page</title>
</head>
<body>
<?php
if($user){
echo '<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>Oh no</strong> User already exists!
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>';
}
?>
<?php
if($success){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong></strong> You are successfully signed up!
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>';
}
?>
<h3 class="text-center"> Sign up page </h3>
<div class="container mt-5">
<form action="signup.php" method="post">
<div class="form-group">
<label for="exampleInputEmail1">Employee ID</label>
<input type="text" class="form-control" placeholder="Enter Employee ID" name="employeeID">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" placeholder="Enter Password" name="password">
</div>
<button type="submit" class="btn btn-primary w-100">Sign Up</button>
</form>
</div>
</body>
</html>