-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
116 lines (69 loc) · 1.8 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
<!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 PAGE</title>
<style>
body {
background-image: url('');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
.BOX{
}
.pdetail{
}
</style>
</head>
<body>
<div class="BOX">
<?php
include('conf.php');
$name=$_POST['name'];
$age=$_POST['age'];
$phone_num=$_POST['phone_num'];
$Username=$_POST['Username'];
$password=$_POST['password'];
// create assertion so that no value is null
if (empty($name) || empty($age) || empty($phone_num) || empty($Username) || empty($password)) {
echo "Please fill all the fields";
exit();
}
else {
// check if username already exists
$sql = "SELECT * FROM admin_login WHERE Username='$Username'";
$result1 = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result1);
if ($resultCheck > 0) {
echo "Username already exists";
exit();
} else {
// insert user into database
$sql = "INSERT INTO login(name, age, phone_num, Username, password) VALUES ('$name', '$age', '$phone_num', '$Username', '$password')";
$result1 = mysqli_query($conn, $sql);
if ($result1) {
header("Location: svmhome.html");
exit();
} else {
echo "Signup failed";
exit();
}
}
}
$sql="INSERT INTO login(Username,password,name,age,phone_num) VALUES('$Username','$password','$name','$age','$phone_num')";
$res=mysqli_query($conn,$sql);
if($res)
{
header('location:svmlogin.html');
}
else
{
echo"connection not established";
}
?>
</div>
</body>
</html>