-
Notifications
You must be signed in to change notification settings - Fork 8
/
register.php
168 lines (147 loc) · 4.14 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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Signup</title>
<!-- font awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
<style>
body{
margin: 0;
padding: 0;
background-image: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)), url('images/pizza.jpg');
background-repeat: no-repeat;
background-size: cover;
box-sizing: border-box;
z-index: -9999;
height: 100vh;
}
}
a{
text-decoration: none;
}
a:hover{
text-decoration: none;
}
.wrap{
top: 5%;
position: relative;
max-width: 350px;
border-radius: 20px;
margin: auto;
background: rgba(0,0,0,0.8);
padding: 20px 40px;
color: #fff;
box-sizing: border-box;
z-index: 999;
}
h2{
text-align: center;
}
h6{
text-align: center;
padding: 5px 1px;
}
input[type=text], input[type=number], input[type=email], input[type=text], textarea, input[type=password]{
width: 100%;
box-sizing: border-box;
padding: 12px 5px;
background: rgba(0,0,0,0.10);
outline: none;
border: none;
border-bottom: 1px solid #fff;
color: #fff;
border-radius: 5px;
margin: 5px;
font-weight: bold;
}
input[type=submit]{
width: 100%;
box-sizing: border-box;
padding: 10px 0;
margin-top: 30px;
outline: none;
border: none;
background: linear-gradient(to right, #ff105f, #ffad06);
border-radius: 20px;
font-size: 20px;
color: #fff;
}
input[type=submit]:hover{
background: linear-gradient(to left, #ff105f, #ffad06);
}
@media screen and (max-width: 579px){
.wrap{
top: 10%;
}
}
</style>
</head>
<body>
<div class="wrap">
<h2>Register</h2>
<form action="register.php" method="post">
<input class="" type="text" name="name" value="" placeholder="Name" required>
<input class="" type="number" name="mobile" value="" placeholder="Mobile Number" required>
<input class="" type="email" name="email" value="" placeholder="Email" required>
<textarea class="" name="address" placeholder="Address" required></textarea>
<input class="" type="password" name="password" value="" placeholder="Password" required>
<input class="" type="password" name="cpassword" value="" placeholder="Confirm Password" required>
<input type="submit" name="submit" value="Register" class="">
<h6 class="pt-3">Aleready Have an Acccount? <a href="login.php">Login</a></h6>
</form>
</div>
<script src="bootstrap/jss/jquery.min.js"></script>
<script src="bootstrap/jss/popper.min.js"></script>
<script src="bootstrap/jss/bootstrap.min.js"></script>
</body>
<?php
if (isset($_POST['submit']))
{
include('dbcon.php');
$name = $_POST['name'];
$mobile = $_POST['mobile'];
$address = $_POST['address'];
$email = $_POST['email'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];
if ($password != $cpassword)
{
?>
<script type="text/javascript">
alert("Password and Confirm Password not match!");
</script>
<?php
die();
}
$esql = "SELECT 1 FROM `user` WHERE `email` = '$email'";
$erun = mysqli_query($conn, $esql);
if (mysqli_num_rows($erun) > 0)
{
?>
<script type="text/javascript">
alert("Email Aleready Exist!");
</script>
<?php
die();
}
$sql = "INSERT INTO `user`(`name`, `mobile`, `address`, `email`, `password`, `cpassword`) VALUES ('$name', '$mobile', '$address', '$email', '$password', '$cpassword')";
$run = mysqli_query($conn, $sql);
if ($run == true)
{
?>
<script>
alert("User Registration Successfully !");
window.open('login.php','_self')
</script>
<?php
}
else
{
echo "ERROR: $sql. " . mysqli_error($conn);
}
}
?>