-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
122 lines (81 loc) · 3.08 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
<?php
require_once('database.php');
$error="";
?>
<?php
if(isset($_POST['submit'])){
$fullname= $_POST['fullname'];
$username= $_POST['username'];
$email= $_POST['email'];
$password= $_POST['password'];
if(empty($fullname and $username and $password and $email)){
$error="All Form Must be Filled Up";
}
else if(!preg_match ("/^[A-Z a-z]+$/", $fullname)) {
$error= " !Name Not Valid";
}
else if(!preg_match('/^[a-zA-Z0-9_]{5,}$/', $username)) {
$error= " !Length Should be more than 5";
}
else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error= " !Invalid email format";
}
else{
$sqladmin="select username from admin where username = '$username'";
$recordadmin=mysqli_query($connect,$sqladmin);
$sqlcustomer="select username from customer where username = '$username'";
$recordcustomer=mysqli_query($connect,$sqlcustomer);
if(mysqli_num_rows($recordadmin)>0){
$error= " !Username Already Exists";
}
else if(mysqli_num_rows($recordcustomer)>0)
{
$error= " !Username Already Exists";
}
else{
$sqladd= "INSERT INTO customer(customer_name,username,email,password) values('$fullname','$username','$email','".md5($password)."')";
$records=mysqli_query($connect,$sqladd);
if($records==true){
$error="Thankyou For Registration Food Engine Account";
}
else{
$error="Failed to Registraion! Try Again";
}
}
}
}
?>
<div class="right">
<div>
<form action="#" method="post" enctype="multipart/form-data">
<table>
<p class="t">Create Food Engine Account</p>
<tr>
<td><label>Full Name</label></td>
<td><input type="text" placeholder="Full Name" name="fullname"></td>
</tr>
<tr>
<td><label>Username</label></td>
<td><input type="text" placeholder="Username" name="username"></td>
</tr>
<tr>
<td><label>Email</label></td>
<td><input type="email" placeholder="email" name="email"></td>
</tr>
<tr>
<td><label>Password</label></td>
<td><input type="password" placeholder="password" name="password"></td>
</tr>
<tr>
<td><input type="submit" value="Register" name="submit"></td>
</tr>
</table>
</form>
<?php
echo "<p style='text-align:center;color:black; text-shadow: 0 0 5px #FFF, 0 0 10px #FFF, 0 0 15px #FFF, 0 0 20px #49ff18,
0 0 30px #49FF18, 0 0 40px #49FF18, 0 0 55px #49FF18, 0 0 75px #49ff18; margin-right:80px'>";
echo $error;
echo "</p>"
?>
</div>
</div>