-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistrationnurse.php
More file actions
301 lines (214 loc) · 8.47 KB
/
registrationnurse.php
File metadata and controls
301 lines (214 loc) · 8.47 KB
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registration page</title>
<style type="text/css">
form-group{ width:30%;
}
</style>
</head>
<div class="row">
<div class="col-sm-3">
<div class="list-group width">
<a href="navi_registra.php" class="list-group-item list-group-item-action active">Dashboard</a>
<a href="registrationnurse.php" class="list-group-item list-group-item-action">Registration</a>
<a href="reglist.php" class="list-group-item list-group-item-action">List of nurses registered</a>
<a href="generatetablecert.php" class="list-group-item list-group-item-action">Generate birth certificate</a>
<a href="generatetablecert.php" class="list-group-item list-group-item-action">Generate birth certificate</a>
<a href="signout.php" class="list-group-item list-group-item-action">sign out</a>
</div>
</div>
<div class="col-lg-9">
<body>
<h4 align="center">REPUBLIC OF KENYA</h4>
<h4 align="center">3E BIRTHS AND DEATHS REGISTRATION ACT</h2>
<h5 align="center">(Cap. 149)</h5>
<h6 align="center">Nurse REGISTRATION FORM</h6>
<div class="container-fluid" id="registration-form">
<form action="" method="post" name="myform" onsubmit="return(timo())" enctype="multipart/form-data">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<label>Username: </label>
<input type="text" name="username" class="form-control" placeholder="Enter username" id="user"required/>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label> Password:</label>
<input type="password" name="password" class="form-control" placeholder="password" id="pass"required/>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>confirm password:</label>
<input type="password" name="confirmpassword" class="form-control" placeholder="confirm password" id="pass1"
required/>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>FirstName:</label>:
<input type="text" name="firstname" class="form-control" placeholder="Enter firstname" required/>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<label>Middlename:</label>
<input type="text" name="Middlename" class="form-control" placeholder="Enter middlename" required/>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>Surname:</label>
<input type="text" name="surname" class="form-control" placeholder="Enter surname" required/>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>station:</label>
<select name="station" class="form-control">
<option>choose station</option>
<option>kericho hospital</option>
<option> Nairobi hospital</option>
<option>Kisumu Hospital</option>
<option>Mombasa Hospital</option>
<option>Machakos Hospital</option>
<option>Maseno health centre</option>
</select>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>id no:</label>
<input type="int" name="id_no" class="form-control" placeholder="Enter identification number" maxlength="8" min="8" id="idno" required/>
</div>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label>nurse no:</label>
<input type="text" name="nurse_no" class="form-control" placeholder="Enter nurse number " required/>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>upload image</label>
<input type="file" name="img" class="form-control" required/><br/>
</div>
</div>
</div>
</div>
<div>
<input type="submit" name="submit" value="Register"/>
</div>
</form>
</div>
</div>
</div>
</div>
<?php
$conn= mysqli_connect("localhost", "root", "" )or die (mysqli_error());
mysqli_select_db ($conn, "health" )or die(mysqli_error());
if(isset($_POST['submit'])){
$username=$_POST['username'];
$password = $_POST['password'];
$confirmpassword= $_POST['confirmpassword'];
$firstname = $_POST['firstname'];
$middlename = $_POST['Middlename'];
$surname = $_POST['surname'];
$station=$_POST['station'];
$id_no = $_POST['id_no'];
$nurse = $_POST['nurse_no'];
$restrictuser =mysqli_query($conn, "SELECT * FROM registration WHERE username='$username'") or die(mysqli_error($conn));
$rowu=mysqli_num_rows($restrictuser);
$restrictpass =mysqli_query($conn, "SELECT * FROM registration WHERE password='$password'") or die(mysqli_error($conn));
$rowp=mysqli_num_rows($restrictpass);
if($rowu>0){
echo '<script type="text/javascript">';
echo 'window.alert("Please choose another username ");';
echo 'window.location.href="registrationnurse.php";';
echo '</script>';
}elseif($rowp>0){
echo '<script type="text/javascript">';
echo 'window.alert("Please choose another password ");';
echo 'window.location.href="registrationnurse.php";';
echo '</script>';
}else{
$uploadDir ='uploads/';
$fileName=$_FILES['img']['name'];
$tmpName=$_FILES['img']['tmp_name'];
$fileSize=$_FILES['img']['size'];
$fileType=$_FILES['img']['type'];
$filePath=$uploadDir.$fileName;
$result=move_uploaded_file($tmpName,$filePath);
$sql = "INSERT INTO registration(username, password, firstname, middlename, surname, station,id_no, nurse_no,path) value
('$username','$password','$firstname','$middlename','$surname','$station','$id_no','$nurse','$filePath')" or die (mysqli_error($conn));
//$sql= "INSERT INTO `child`(`serial_no`, `Firstname`, `Othername`, `Surname`, `Date_of_birth`, `phone`, `Sex`, `Type_of_birth`, `Nature_of_birth`, `place_of_birth(hospital)`, `District`) VALUES
//([$serial_no],[$firstname],[$othername],[$surname],[$dob],[$phone],[$sex],[$typeofbirt],[$natureofbirt],[$placeofbirth],[$district])" or die (mysql_error());
if ($password!= $confirmpassword){
echo '<script type="text/javascript">';
echo 'window.alert("password do not match ");';
echo 'window.location.href="registrationnurse.php";';
echo '</script>';
}else if($station =='choose station'){
echo'<script type="text/javascript">';
echo'window.alert("Please choose the right hospital station");';
echo 'window.location.href="registrationnurse.php";';
echo '</script>';
}else{
if(mysqli_query( $conn, $sql,$result)){
echo '<script> window.alert("Records added successfully.") </script>';
} else{
echo '<script>window.alert("ERROR: Could not able to execute $sql. ")</script>';
}
}
}
}
// close connection
mysqli_close($conn);
?>
<script>
function timo(){
var pas1=document.getElementById('pass');
var pas2=document.getElementById('pass1');
var user2=document.getElementById('user');
var idnoh=document.getElementById('idno');
var test1=/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}$/;
var testuser= /^[a-zA-Z0-9_]+$/;
var idnox= /^\([0-9]{8})$/;
if(!test1.test(pas1.value)){
alert(' at least one number, one lowercase and one uppercase letter and at least six characters that are letters, numbers or the underscore');
pass.focus;
return false;
}else if(!idnox.test(idnoh.value))
alert('id number must be in numbers');
idno.focus;
return false;
}
}
</script>
</body>
</div>
</html>
<footer>
<div class="container-fluid padding">
<div class="row text-center">
<div class="col-12">
<hr class="light">
<h5>© timothy.com</h5>
<a href="navi_registra.php" button type="button" class="btn btn-default">Back</button>
</div>
</div>
</div>
</footer>