-
Notifications
You must be signed in to change notification settings - Fork 2
/
signup.php
146 lines (131 loc) · 5.37 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
<!DOCTYPE html>
<html>
<head>
<title>Sign up form</title>
<link rel="stylesheet" type="text/css" href="css/reg.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<script src="js/jquery.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Passion+One' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://fontawesome.io/assets/font-awesome/css/font-awesome.css">
<body>
<div class="container">
<div class="row">
<div class="panel-heading">
<div class="panel-title text-center">
<h1 class="title">Registration</h1>
</div>
</div>
<div class="main-login main-center">
<form class="form-horizontal" method="post" action="#">
<div class="form-group">
<label for="name" class="cols-sm-2 control-label">Your Name</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
<input type="text" class="form-control" name="uname" id="name" maxlength="30" placeholder="Enter your Name"/>
</div>
</div>
</div>
<div class="form-group">
<label for="email" class="cols-sm-2 control-label">Your Address</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-address-book" aria-hidden="true"></i></span>
<input type="email" class="form-control" name="address" maxlength="25" id="email" placeholder="Enter your Address"/>
</div>
</div>
</div>
<div class="form-group">
<label for="email" class="cols-sm-2 control-label">Your Phone</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-phone-square" aria-hidden="true"></i></span>
<input type="email" class="form-control" name="phone" maxlength="20" id="email" placeholder="Enter your Phone"/>
</div>
</div>
</div>
<div class="form-group">
<label for="email" class="cols-sm-2 control-label">Your Email</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope fa" aria-hidden="true"></i></span>
<input type="email" class="form-control" name="email" maxlength="40" id="email" placeholder="Enter your Email"/>
</div>
</div>
</div>
<div class="form-group">
<label for="username" class="cols-sm-2 control-label">Username</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-users fa" aria-hidden="true"></i></span>
<input type="text" class="form-control" name="username" maxlength="35" id="username" placeholder="Enter your Username"/>
</div>
</div>
</div>
<div class="form-group">
<label for="password" class="cols-sm-2 control-label">Password</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span>
<input type="password" class="form-control" name="passwd1" maxlength="35" id="password" placeholder="Enter your Password"/>
</div>
</div>
</div>
<div class="form-group">
<label for="confirm" class="cols-sm-2 control-label">Confirm Password</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span>
<input type="password" class="form-control" name="passwd2" maxlength="35" id="confirm" placeholder="Confirm your Password"/>
</div>
</div>
</div>
<div class="form-group ">
<button type="button" name="btn_sub" class="btn btn-primary btn-lg btn-block login-button"><i class="fa fa-user-circle" aria-hidden="true"></i> Register</button>
</div>
<div class="login-register">
<a class="btn btn-default btn-lg" href="index.php"><i class="fa fa-user-circle" aria-hidden="true"></i> Login</a>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
<?php
error_reporting(0);
require 'config.php';
if (isset($_POST['btn_sub'])) {
$uname = $_POST['uname'];
$adres = $_POST['address'];
$phn = $_POST['phone'];
$email = $_POST['email'];
$username = $_POST['username'];
$pass1 = $_POST['passwd1'];
$pass2 = $_POST['passwd2'];
if(empty($uname) || empty($adres) || empty($phn) || empty($email) || empty($username) || empty($pass1) || empty($pass2)){
echo "all fields are required";
}else {
if ($pass1 == $pass2) {
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$conn = mysqli_connect($host, $user, $pass, $db) or die ("Error while connecting to database");
//$password = password_hash($pass1, PASSWORD_BCRYPT);
$password = $pass1;
$query = "INSERT INTO usr_info VALUE(NULL, '$uname', '$adres', '$phn', '$email', '$username', '$password')";
$result = mysqli_query($conn, $query);
if ($result) {
echo "<br><br><br><center><h1>Successfully Registered";
echo "<br><br><a href='index.php'>Login</a></h1></center>";
}else{
echo "Data is not inserted";
}
}else{
echo "you must enter a valid email";
}
}else {
echo "Password not match";
}
}
}
?>