-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunc.php
186 lines (164 loc) · 4.71 KB
/
func.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
<?php
// connect to the database
$con = mysqli_connect("localhost","root","","hmsdb") ;
// if the form is submitted the following will work
if (isset($_POST['login_submit'])) {
// we have our variables
$username=$_POST['username'];
$password=$_POST['password'];
// the username and password in the database should be equal to that which is used in login.
$query="select * from logintb where username= '$username' and password= '$password' ";
//the result
$result=mysqli_query($con,$query);
//
if (mysqli_num_rows($result)==1) {
header("location:dashboard.php");
}
else
{
header("location: index.html");
}
}
// appointment
if (isset($_POST['submit'])) {
$fullname=$_POST['fullname'];
$age=$_POST['age'];
$weight=$_POST['weight'];
$phone=$_POST['phone'];
$nextofkin=$_POST['nextofkin'];
$address =$_POST['address'];
$specialist=$_POST['specialist'];
$medcondition=$_POST['medcondition'];
$query= "INSERT INTO appointment (fullname, age, weight, phone, nextofkin, address, specialist, medcondition)
VALUES ('$fullname','$age','$weight', '$phone', '$nextofkin', '$address',
'$specialist', 'medcondition')";
$result=mysqli_query($con,$query);
if ($result) {
echo "<script> alert('appointment registered')</script>";
header("location:appointment.php");
}
}
// doctors app
// appointment
if (isset($_POST['submit1'])) {
$fullname=$_POST['fullname'];
$age=$_POST['age'];
$weight=$_POST['weight'];
$phone=$_POST['phone'];
$address =$_POST['address'];
$specialist=$_POST['specialist'];
$medcondition=$_POST['medcondition'];
$query= "INSERT INTO appointment (fullname, age, weight, phone, address, specialist, medcondition)
VALUES ('$fullname','$age','$weight', '$phone', '$address',
'$specialist', 'medcondition')";
$result=mysqli_query($con,$query);
if ($result) {
echo "<script> alert('appointment registered')</script>";
header("location:appointmenthistory.php");
}
}
//admin
if (isset($_POST['submit2'])) {
$fullname=$_POST['fullname'];
$age=$_POST['age'];
$weight=$_POST['weight'];
$phone=$_POST['phone'];
$address =$_POST['address'];
$specialist=$_POST['specialist'];
$medcondition=$_POST['medcondition'];
$query= "INSERT INTO appointment (fullname, age, weight, phone, address, specialist, medcondition)
VALUES ('$fullname','$age','$weight', '$phone', '$address',
'$specialist', 'medcondition')";
$result=mysqli_query($con,$query);
if ($result) {
echo "<script> alert('appointment registered')</script>";
header("location:adminappointmentlist.php");
}
}
function get_patient_details(){
global $con;
$query= "select * from appointment";
$result =mysqli_query($con, $query);
while ($row=mysqli_fetch_array($result)) {
$fullname=$row['fullname'];
$age=$row['age'];
$weight=$row['weight'];
$phone=$row['phone'];
$address =$row['address'];
$specialist=$row['specialist'];
$medcondition=$row['medcondition'];
echo"
<tr>
<td>$fullname</td>
<td>$age</td>
<td>$weight</td>
<td>$phone</td>
<td>$address</td>
<td>$specialist</td>
<td>$medcondition</td>
</tr>
";
}
}
// patients list
function get_patientlogin_details(){
global $con;
$query= "select * from patients";
$result =mysqli_query($con, $query);
while ($row=mysqli_fetch_array($result)) {
$username=$row['username'];
$email=$row['email'];
$password=$row['password'];
echo"
<tr>
<td>$username</td>
<td>$email</td>
<td>$password</td>
</tr>
";
}
}
//
if(isset($_POST['submit-add'])){
$username=$_POST['username'];
$email=$_POST['email'];
$addresst=$_POST['address'];
$age=$_POST['age'];
$phone =$_POST['phone'];
$specialization=$_POST['specialization'];
$password=$_POST['password'];;
$query= "INSERT INTO doctors (username, email, address, age, phone, specialization, password)
VALUES ('$username','$email', '$address', '$age', '$phone', '$specialization', '$password')";
$result=mysqli_query($con,$query);
if ($result) {
echo "<script> alert('docto added')</script>";
header("location:doctorlist.php");
}
}
//
function get_patients_details(){
global $con;
$query= "select * from doctors";
$result =mysqli_query($con, $query);
while ($row=mysqli_fetch_array($result)) {
$username=$row['username'];
$email=$row['email'];
$address =$row['address'];
$age=$row['age'];
$phone=$row['phone'];
$specialization=$row['specialization'];
$password=$row['password'];
echo"
<tr>
<td>$username</td>
<td>$email</td>
<td>$address</td>
<td>$age</td>
<td>$phone</td>
<td>$specialization</td>
<td>$password</td>
</tr>
";
}
}
?>