forked from tushar8848/Attendance-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
190 lines (147 loc) · 5.27 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
include('connect.php');
try{
if(isset($_POST['signup'])){
if(empty($_POST['email'])){
throw new Exception("Email cann't be empty.");
}
if(empty($_POST['uname'])){
throw new Exception("Username cann't be empty.");
}
if(empty($_POST['pass'])){
throw new Exception("Password cann't be empty.");
}
if(empty($_POST['fname'])){
throw new Exception("Username cann't be empty.");
}
if(empty($_POST['phone'])){
throw new Exception("Username cann't be empty.");
}
if(empty($_POST['type'])){
throw new Exception("Username cann't be empty.");
}
$result = mysql_query("insert into admininfo(username,password,email,fname,phone,type) values('$_POST[uname]','$_POST[pass]','$_POST[email]','$_POST[fname]','$_POST[phone]','$_POST[type]')");
$success_msg="Signup Successfully!";
}
}
catch(Exception $e){
$error_msg =$e->getMessage();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Online Attendance Management System 1.0</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" >
<link rel="stylesheet" href="styles.css" >
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<header>
<h1>Online Attendance Management System 1.0</h1>
</header>
<center>
<h1>Signup</h1>
<div class="content">
<div class="row">
<?php
if(isset($success_msg)) echo $success_msg;
if(isset($error_msg)) echo $error_msg;
?>
<!-- Old version started -->
<!--<form action="" method="post">
<table>
<tr>
<td>Email</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="uname"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="Password" name="pass"></td>
</tr>
<tr>
<td>Full Name</td>
<td><input type="text" name="fname"></td>
</tr>
<tr>
<td>Phone Number</td>
<td><input type="text" name="phone"></td>
</tr>
<tr>
<td>Type</td>
<td> <select name="type">
<option name="teacher" value="teacher">Teacher</option>
<option name="student" value="student">Student</option>
</select></td>
</tr>
<tr><td><br></td></tr>
<tr>
<td></td>
<td><input type="submit" name="signup" value="Signup"></td>
</tr>
</table>
</form>--><!-- Old version ended -->
<form method="post" class="form-horizontal col-md-6 col-md-offset-3">
<div class="form-group">
<label for="input1" class="col-sm-3 control-label">Email</label>
<div class="col-sm-7">
<input type="text" name="email" class="form-control" id="input1" placeholder="your email" />
</div>
</div>
<div class="form-group">
<label for="input1" class="col-sm-3 control-label">Username</label>
<div class="col-sm-7">
<input type="text" name="uname" class="form-control" id="input1" placeholder="choose username" />
</div>
</div>
<div class="form-group">
<label for="input1" class="col-sm-3 control-label">Password</label>
<div class="col-sm-7">
<input type="password" name="pass" class="form-control" id="input1" placeholder="choose a strong password" />
</div>
</div>
<div class="form-group">
<label for="input1" class="col-sm-3 control-label">Full Name</label>
<div class="col-sm-7">
<input type="text" name="fname" class="form-control" id="input1" placeholder="your full name" />
</div>
</div>
<div class="form-group">
<label for="input1" class="col-sm-3 control-label">Phone Number</label>
<div class="col-sm-7">
<input type="text" name="phone" class="form-control" id="input1" placeholder="your phone number" />
</div>
</div>
<div class="form-group" class="radio">
<label for="input1" class="col-sm-3 control-label">Role</label>
<div class="col-sm-7">
<label>
<input type="radio" name="type" id="optionsRadios1" value="student" checked> Student
</label>
<label>
<input type="radio" name="type" id="optionsRadios1" value="teacher"> Teacher
</label>
<!-- <label>
<input type="radio" name="type" id="optionsRadios1" value="admin"> Admin
</label> -->
</div>
</div>
<input type="submit" class="btn btn-primary col-md-2 col-md-offset-8" value="Signup" name="signup" />
</form>
</div>
<br>
<p><strong>Already have an account? <a href="index.php">Login</a> here.</strong></p>
</div>
</center>
</body>
</html>