-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
133 lines (89 loc) · 3.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
<?php
include "header.php";
?>
<!DOCTYPE html>
<html>
<head>
<title> User registration from </title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body background ="img/background.jpg">
</br></br></br></br></br></br></br>
<div class="box_reg">
<?php
include "db.php";
// include "header.php";
if(isset($_POST["reg"])){
$username = $_POST["name"];
$email = $_POST["email"];
$address = $_POST["address"];
$phone = $_POST["phone"];
$password = $_POST["pass"];
$password = md5($password);
$tmsql = "select * from users where email = '$email' ";
$tre1 = mysqli_query($con,$tmsql);
$number1 = mysqli_num_rows($tre1);
if( $number1 > 0)
{
echo "
<center> <div class='alert alert-success'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b style='color:red;'>Registration with username ".$email." already exist.</b>
</div></center>
";
}
else{
$sql = "INSERT INTO `users`
(`username`, `email`, `address`, `password`, `phone`)
VALUES ('$username','$email','$address','$password','$phone')";
if (mysqli_query($con,$sql)) {
echo "
<center> <div class='alert alert-success'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b style='color:green;'>Registration is successfull!</b>
</div></center>
";
?>
<script type="text/javascript">
<!--
function Redirect() {
window.location="index.php";
}
setTimeout('Redirect()', 2000);
//-->
</script>
<?php
}
}
}
?>
<h2>Registration</h2>
<form action="" method="post">
<div class="inputbox">
<input type="text" name="name" required="" autocomplete="off">
<label>Username</label>
</div>
<div class="inputbox">
<input autocomplete="off" type="text" pattern="(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" title="[email protected]" name="email" required="">
<label>Email</label>
</div>
<div class="inputbox">
<input type="text" name="address" required="" autocomplete="off">
<label>Address</label>
</div>
<div class="inputbox">
<input type="text" name="phone" pattern="^01[567398][0-9]{8}" title="11 digits" required="" autocomplete="off">
<label>Phone No</label>
</div>
<div class="inputbox">
<input type="password" name="pass" required="" autocomplete="off">
<label>Password</label>
</div>
<center>
<input type="submit" class="btn btn-primary" name="reg" value="Register"><br><br>
</center>
</form>
</div>
</div>
</body>
</html>