forked from bhakti-kantariya/Riddikulus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
166 lines (124 loc) · 4.07 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
<html>
<head>
<title>Register</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
#d01{
background: url(header-image.jpg) no-repeat center;
background-size: cover;
}
.error {color: #FF0000;}
#s01{
margin-left: 39%;
}
footer {
color: black;
background-color: rgb(213,213,213);
clear: left;
text-align: right;
border-radius: 7px 7px 0px 0px;
bottom:0;
width: 98%;
position: absolute;
}
.b01{
background-color: transparent;
border: none;
font-size: 1em;
color: #aaaaaa;
}
.b01:hover{
background-color: transparent;
border: none;
font-size: 1em;
color: #ffffff;
}
</style>
</head>
<body>
<!-- Code for registration -->
<?php
if (isset($_POST["register-submit"]))
{
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "riddikulus";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// prepare and bind
$stmt = $conn->prepare("INSERT INTO users (contact_no,user_name,email_id,password) VALUES (?,?,?,?)");
$stmt->bind_param("ssss",$contact_no,$user_name,$email_id,$password);
// set parameters and execute
/*
$age = $_POST["age"];
$edu = $_POST["edu"];
$income = $_POST["income"];
$gen = $_POST["gen"];
*/
$contact_no = $_POST["contact_no"];
$user_name = $_POST["user_name"];
$email_id = $_POST["email_id"];
$password = $_POST["password"];
//$admin = 0;
$stmt->execute();
if($stmt)
{
header('Location: map.php');
//echo "New User created successfully";
}
else{
header('Location: register.php');
//echo "Unsuccessful";
}
//echo "New User created successfully";
$stmt->close();
$conn->close();
}
?>
<div class="container-fluid" >
<div class="row-fluid" style="width: 100%">
<div id="d01" class="col-lg-12 col-sm-12 col-xs-12 col-md-12 withimg" style="padding: 0px;width: 100%; height: 200px">
</div>
<div class="row-fluid" style="width: 100%">
<center>.
<br><br><br>
<h1 style="font-family: sans-serif; color:rgb(130,130,130); text-shadow: 3px 3px black ; font-size: 3.5em"><b>REGISTER</b></h1>
</center>
</div>
<div class="row">
<form method="post">
<section id="s01">
<fieldset>
<br>
<label>Username:</label> <input type = "text" name = "user_name" class="form-control" placeholder="Username" required="" style="width: 200px;display: inline;margin-left: 20px;" >
<span class="error">*</span>
<br><br>
<label>Mobile:</label> <input type = "text" name = "contact_no" class="form-control" placeholder="Contact Number" required="" style="width: 200px;display: inline;margin-left: 20px;" >
<span class="error">*</span>
<br><br>
<label>Password:</label> <input type = "password" name = "password" class="form-control" placeholder="password" required="" style="width: 200px;display: inline;margin-left: 20px;">
<span class="error">*</span>
<br><br>
<label>Email:</label> <input type = "text" class="form-control" placeholder="[email protected]" name = "email_id" required="" style="width: 200px;display: inline;margin-left: 20px;">
<span class="error">*</span>
<br><br>
<input type="submit" name="register-submit" id="register-submit" value="Submit">
<br><br>
</fieldset>
</section>
</form>
</div>
</div>
<div class="row-fluid">
<footer>Copyright ©Riddikulus .</footer>
</div>
</body>
</html>