-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
166 lines (131 loc) · 6.52 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
<?php
require 'users/connection.php';
if(isset($_POST['btn'])){
$name = $_POST['name'];
$mobile_number = $_POST['mn'];
$email = $_POST['email'];
$un = $_POST['username'];
$pass = md5($_POST['password']);
$roll = $_POST['rn'];
$sqlS = "SELECT * FROM registration_table";
$row = mysqli_query($conn,$sqlS);
if($row->num_rows == 0){
$sql = "INSERT INTO registration_table(name,mobile_number,email,user_name,pass,roll,status) VALUES('$name','$mobile_number','$email','$un','$pass','$roll','2')";
if(mysqli_query($conn, $sql)){
header('Location: index.php');
} else {
echo 'Data Not Insert';
}
}else{
$sql = "INSERT INTO registration_table(name,mobile_number,email,user_name,pass,roll,status) VALUES('$name','$mobile_number','$email','$un','$pass','$roll','1')";
if(mysqli_query($conn, $sql)){
header('Location: index.php');
} else {
echo 'Data Not Insert';
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Fonts -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/mystyle.css">
<title>Online exam</title>
</head>
<body>
<?php include 'includes/navber.php'; ?>
<div class="container">
<div class="row justify-content-center mt-4">
<div class="col-md-8">
<div class="card">
<div class="card-header mch">Student Registration</div>
<div class="card-body">
<form class="form-horizontal" action="" method="POST" onsubmit="return validation()">
<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">
<input type="text" class="form-control" name="name" id="name" placeholder="Enter your Name" required/>
</div>
</div>
</div>
<div class="form-group">
<label for="mn" class="cols-sm-2 control-label">Mobile Number</label>
<div class="cols-sm-10">
<div class="input-group">
<input type="Number" class="form-control" name="mn" id="mn" placeholder="Enter your Username" required/>
</div>
<span id="smn" style="color:red;"></span>
</div>
</div>
<script type="text/javascript">
function validation(){
//user Validation
var mn = document.getElementById("mn").value;
if(mn.length<11 || mn.length>=12){
document.getElementById("smn").innerHTML="Invalid Mobile Number";
return false;
}
}
</script>
<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">
<input type="email" class="form-control" name="email" id="email" placeholder="Enter your Email" required/>
</div>
</div>
</div>
<div class="form-group">
<label for="rn" class="cols-sm-2 control-label">Roll Number</label>
<div class="cols-sm-10">
<div class="input-group">
<input type="Number" class="form-control" name="rn" id="rn" placeholder="Enter your roll number" required/>
</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">
<input type="text" class="form-control" name="username" id="username" placeholder="Enter your Username" required/>
</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">
<input type="password" class="form-control" name="password" id="password" placeholder="Enter your Password" required/>
</div>
<span id="spass" style="color:red;"></span>
</div>
</div>
<script type="text/javascript">
function validation(){
//Password Validation
var UN = document.getElementById("password").value;
if(UN.length<3 || UN.length>10){
document.getElementById("spass").innerHTML="Password must have 3 to 10 charecter";
return false;
}
}
</script>
<div class="form-group mt-2">
<input type="submit" name="btn" class="btn btn-danger">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</body>
</html>