-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathst_reg.php
136 lines (113 loc) · 3.99 KB
/
st_reg.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
<?php
session_start();
require "php/config.php";
require_once "php/functions.php";
$user = new login_registration_class();
if($user->getsession()){
header('Location: st_profile.php');
}
?>
<?php
$pageTitle = "Student Registration";
include "header.php";
?>
<div class="st_reg fix">
<h2>Student Registration form</h2>
<p class="msg">
<?php
if($_SERVER['REQUEST_METHOD'] == "POST"){
$st_id = $_POST['st_id'];
$st_name = $_POST['st_name'];
$st_pass = $_POST['st_pass'];
$st_email = $_POST['st_email'];
$BirthMonth = $_POST['BirthMonth'];
$BirthDay = $_POST['BirthDay'];
$BirthYear = $_POST['BirthYear'];
$bday = "{$BirthYear}-{$BirthMonth}-{$BirthDay}";
$st_dept = $_POST['st_dept'];
$st_contact = $_POST['st_contact'];
$st_gender = $_POST['gender'];
$st_add = $_POST['st_add'];
if(empty($st_id) or empty($st_name) or empty($st_pass ) or empty($st_email) or empty($BirthMonth) or empty($BirthDay) or empty($BirthYear) or empty($st_dept) or empty($st_contact) or empty($st_gender) or empty($st_add)){
echo "<p style='color:red;text-align:center'>**Field must not be empty**</p>";
}else{
$st_pass = md5($st_pass);
$st_register = $user->st_registration($st_id,$st_name,$st_pass,$st_email,$bday,$st_dept,$st_contact,$st_gender,$st_add);
if($st_register){
echo "<h3 style='color:green;margin:0;padding:0;text-align:center'>Registration Complete !! <a style='font-size:20px;color:#8e44ad' href='st_login.php'>Login</a></h3>";
}else{
echo "<p style='color:red;text-align:center'>Error..Student ID or email Already exists</p>";
}
}
}
?>
</p>
<form action="" method="post" id="st_form">
<table>
<tr>
<th>Name: </th>
<td><input type="text" name="st_name" placeholder="Full Name" required /></td>
</tr>
<tr>
<tr>
<th>Student ID: </th>
<td><input type="text" name="st_id" placeholder="Student Id" required /></td>
</tr>
<tr>
<th>Password: </th>
<td><input type="password" name="st_pass" placeholder="password" required /></td>
</tr>
<tr>
<th>E-mail: </th>
<td><input type="email" name="st_email" placeholder="example@email.com" required /></td>
</tr>
<tr>
<th>Date of Birth: </th>
<td>
<fieldset>
<select class="select-style" name="BirthMonth">
<option value="01">Jan</option>
<option value="02">Feb</option>
<option value="03" >March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">Aug</option>
<option value="09">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12" >Dec</option>
</label>
</select>
<label><input class="birthday" maxlength="2" name="BirthDay" placeholder="Day" required=""></label>
<label><input class="birthyear" maxlength="4" name="BirthYear" placeholder="Year" required=""></label>
</fieldset>
</td>
</tr>
<tr>
<th>Program:</th>
<td><input type="text" name="st_dept" placeholder="BCSE,BSEEE, BBA..." required /></td>
</tr>
<tr>
<th>Contact:</th>
<td><input type="text" name="st_contact" placeholder="phone" required /></td>
</tr>
<tr>
<th>Gender:</th>
<td><label><input type="radio" name="gender" value="Male" checked/> Male</label>
<label><input type="radio" name="gender" value="Female"/> Female</label>
<label><input type="radio" name="gender" value="Other"/> Other</label>
</td>
</tr>
<tr>
<th>Address:</th>
<td><input type="text" name="st_add" placeholder="Address" required /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="sub" value="Register" /></td>
</tr>
</table>
</form>
</div>
<?php include "footer.php"; ?>