-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
149 lines (97 loc) · 5.43 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!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/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<?php
include "dbconn.php";
if (isset($_POST['submit'])) {
$username=mysqli_real_escape_string($conn,$_POST['fname']);
$email=mysqli_real_escape_string($conn,$_POST['email']);
$phone=mysqli_real_escape_string($conn,$_POST['phone']);
$password=mysqli_real_escape_string($conn,$_POST['password']);
$cpassword=mysqli_real_escape_string($conn,$_POST['cpassword']);
$pass=password_hash($password,PASSWORD_BCRYPT);
$cpass=password_hash($cpassword,PASSWORD_BCRYPT);
$emailquery="SELECT * FROM reg WHERE email='$email'";
$query=mysqli_query($conn,$emailquery);
$result=mysqli_num_rows($query);
if ($result>0) {
?>
<script>
alert("email Already Exists");
</script>
<?php
}else{
if($password ===$cpassword){
$submit="INSERT INTO `reg` (`name`, `email`, `phone`, `password`, `cpassword`) VALUES ('$username', '$email', '$phone', '$pass', '$cpass')";
$check=mysqli_query($conn,$submit);
if ($check) {
?>
<script>
alert("insert succefully");
</script>
<?php
}else{
?>
<script>
alert("NOT INSERTED");
</script>
<?php
}
}else{
?>
<script>
alert("Password did not match");
</script>
<?php
}
}
}
?>
<h1 class="text-center my-5"> Create Account</h1>
<h4 class="text-center my-1"> Get Started With Your Free Account</h4>
<div class="container">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<div class="form-group">
<label for="FullName">Full Name</label>
<input type="text" class="form-control" id="fname" name="fname" placeholder="Enter Your Full name" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Enter Your email" required>
</div>
<div class="form-group">
<label for="phone">Phone</label>
<input type="phone" class="form-control" id="phone" name="phone" placeholder="Enter Your contact" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="type password" required>
</div>
<div class="form-group">
<label for="Confirmpass">Confirmpassword</label>
<input type="password" class="form-control" id="cpassword" name="cpassword" placeholder="Enter Your Confirm password" required>
</div>
<button type="submit" name="submit" class="btn btn-primary btn-lg btn-block">Create Account</button>
<div class="container my-3"><span>Already Have an Account?</span><a href="login.php">Login Here</a></div>
</form>
</div>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: jQuery and Bootstrap Bundle (includes Popper) -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>
<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-+YQ4JLhjyBLPDQt//I+STsc9iw4uQqACwlvpslubQzn4u2UU2UFM80nGisd026JF" crossorigin="anonymous"></script>
-->
</body>
</html>