-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
198 lines (165 loc) · 8.45 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
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!DOCTYPE html>
<html lang="en">
<?php
session_start();
error_reporting(0);
include("connection/connect.php");
if(isset($_POST['submit'] ))
{
if(empty($_POST['firstname']) ||
empty($_POST['lastname'])||
empty($_POST['email']) ||
empty($_POST['phone'])||
empty($_POST['password'])||
empty($_POST['cpassword']) ||
empty($_POST['cpassword']))
{
$message = "All fields must be Required!";
}
else
{
$check_username= mysqli_query($db, "SELECT username FROM users where username = '".$_POST['username']."' ");
$check_email = mysqli_query($db, "SELECT email FROM users where email = '".$_POST['email']."' ");
if($_POST['password'] != $_POST['cpassword']){
echo "<script>alert('Password not match');</script>";
}
elseif(strlen($_POST['password']) < 6)
{
echo "<script>alert('Password Must be >=6');</script>";
}
elseif(strlen($_POST['phone']) < 10)
{
echo "<script>alert('Invalid phone number!');</script>";
}
elseif (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
{
echo "<script>alert('Invalid email address please type a valid email!');</script>";
}
elseif(mysqli_num_rows($check_username) > 0)
{
echo "<script>alert('Username Already exists!');</script>";
}
elseif(mysqli_num_rows($check_email) > 0)
{
echo "<script>alert('Email Already exists!');</script>";
}
else{
$mql = "INSERT INTO users(username,f_name,l_name,email,phone,password,address) VALUES('".$_POST['username']."','".$_POST['firstname']."','".$_POST['lastname']."','".$_POST['email']."','".$_POST['phone']."','".md5($_POST['password'])."','".$_POST['address']."')";
mysqli_query($db, $mql);
header("refresh:0.1;url=login.php");
}
}
}
?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="#">
<title>Registration</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/animsition.min.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<div style=" background-image: url('images/img/pimg.jpg');">
<header id="header" class="header-scroll top-header headrom">
<nav class="navbar navbar-dark">
<div class="container">
<button class="navbar-toggler hidden-lg-up" type="button" data-toggle="collapse" data-target="#mainNavbarCollapse">☰</button>
<a class="navbar-brand" href="index.php"> <img class="img-rounded" src="images/logo.png" alt="" width="18%"> </a>
<div class="collapse navbar-toggleable-md float-lg-right" id="mainNavbarCollapse">
<ul class="nav navbar-nav">
<li class="nav-item"> <a class="nav-link active" href="index.php">Home <span class="sr-only">(current)</span></a> </li>
<li class="nav-item"> <a class="nav-link active" href="restaurants.php">Restaurants <span class="sr-only"></span></a> </li>
<?php
if(empty($_SESSION["user_id"]))
{
echo '<li class="nav-item"><a href="login.php" class="nav-link active">Login</a> </li>
<li class="nav-item"><a href="registration.php" class="nav-link active">Register</a> </li>';
}
else
{
echo '<li class="nav-item"><a href="your_orders.php" class="nav-link active">My Orders</a> </li>';
echo '<li class="nav-item"><a href="logout.php" class="nav-link active">Logout</a> </li>';
}
?>
</ul>
</div>
</div>
</nav>
</header>
<div class="page-wrapper">
<div class="container">
<ul>
</ul>
</div>
<section class="contact-page inner-page">
<div class="container ">
<div class="row ">
<div class="col-md-12">
<div class="widget">
<div class="widget-body">
<form action="" method="post">
<div class="row">
<div class="form-group col-sm-12">
<label for="exampleInputEmail1">User-Name</label>
<input class="form-control" type="text" name="username" id="example-text-input">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputEmail1">First Name</label>
<input class="form-control" type="text" name="firstname" id="example-text-input">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputEmail1">Last Name</label>
<input class="form-control" type="text" name="lastname" id="example-text-input-2">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputEmail1">Email Address</label>
<input type="text" class="form-control" name="email" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputEmail1">Phone number</label>
<input class="form-control" type="text" name="phone" id="example-tel-input-3">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" name="password" id="exampleInputPassword1">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputPassword1">Confirm password</label>
<input type="password" class="form-control" name="cpassword" id="exampleInputPassword2">
</div>
<div class="form-group col-sm-12">
<label for="exampleTextarea">Delivery Address</label>
<textarea class="form-control" id="exampleTextarea" name="address" rows="3"></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<p> <input type="submit" value="Register" name="submit" class="btn theme-btn"> </p>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<?php include "include/footer.php" ?>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/tether.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/animsition.min.js"></script>
<script src="js/bootstrap-slider.min.js"></script>
<script src="js/jquery.isotope.min.js"></script>
<script src="js/headroom.js"></script>
<script src="js/foodpicky.min.js"></script>
</body>
</html>