-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
132 lines (114 loc) · 3.61 KB
/
Copy pathuser.php
File metadata and controls
132 lines (114 loc) · 3.61 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
<!-- Made By Kratu -->
<?php
/*creating a connection with the database*/
$con = mysqli_connect("localhost","root","") or die ("Error Occures");
mysqli_select_db($con, "hospital_management_system") or die("Error Occures");
$username = $_POST["user"];
$password = $_POST["pass"];
$pID="";
$pss="";
/*Assign username and password from the given table if there is*/
$tmp = "SELECT * FROM plog WHERE patient_ID='$username'";
$getData = mysqli_query($con, $tmp);
if($getData){
while($assData=mysqli_fetch_assoc($getData)) {
$pID = $assData["patient_ID"];
$pss = $assData["password"];
}
}
$sql_1 = "SELECT patient_ID,patient_name,phone_number,DOB,gender,ward_ID FROM patient WHERE patient_ID='$username'";
$sql_2 = "SELECT tID,tname,results,s_date,e_date FROM treatment WHERE patient_ID='$username'";
$records_1 = mysqli_query($con, $sql_1);
$records_2 = mysqli_query($con, $sql_2);
if($username==$pID && $password==$pss) {
?>
<html>
<head>
<title>User LoggedIn Interface</title>
<link rel="stylesheet" type="text/css" href="template.css" />
<!-- centering the image -->
<style type="text/css">
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
</style>
</head>
<body>
<div class="template">
<header>
<h1 style="text-align:center;font-sizse:45px">User LogIn Interface</h1>
</header>
<table width="600" border="1" cellpadding="1" cellspacing="1" align="center">
<tr>
<th>Patient ID</th>
<th>Patient Name</th>
<th>Phone Numebr</th>
<th>DOB</th>
<th>Gender</th>
<th>Ward ID</th>
</tr>
<?php
if($records_1){
while($row = mysqli_fetch_assoc($records_1)){
echo "<tr>";
echo "<td>".$row['patient_ID']."</td>";
echo "<td>".$row['patient_name']."</td>";
echo "<td>".$row['phone_number']."</td>";
echo "<td>".$row['DOB']."</td>";
echo "<td>".$row['gender']."</td>";
echo "<td>".$row['ward_ID']."</td>";
echo "</tr>";
}
echo "<table>";
}
?>
<header>
<h2 style="font-size:20px;text-align:center">Patient Treatment and Test Details</h2>
</header>
<table width="600" border="1" cellpadding="1" cellspacing="1" align="center">
<tr>
<th>Treatment ID</th>
<th>Treatment Name</th>
<th>Result</th>
<th>Star Date</th>
<th>End Date</th>
</tr>
<?php
if($records_2){
while($row = mysqli_fetch_assoc($records_2)){
echo "<tr>";
echo "<td>".$row['tID']."</td>";
echo "<td>".$row['tname']."</td>";
echo "<td>".$row['results']."</td>";
echo "<td>".$row['s_date']."</td>";
echo "<td>".$row['e_date']."</td>";
echo "</tr>";
}
echo "<table>";
mysqli_close($con);
}
?>
<br><h3 style="text-align: center;">XRAY</h3>
<!-- retrieving image from local folder, if available . Else display default error image-->
<img src="Patient_Reports/<?php echo $pID; ?>.jpg" onerror="this.onerror=null; this.src='Patient_Reports/default.jpg'" alt="ERROR 404" width="300" height="400" class="center">
<footer>
<div>
<a href="mainPage.php"><button>Log Out</button></a>
</div>
KRATU SHARMA - 18BCE0642 <br>
ANKITA MAITI - 18BCE2078 <br>
BHARAT RAJORA - 18BCE2082 <br>
ATHARVA MANGESHKUMAR AGARWAL - 18BCE2029
</footer>
</div>
</body>
</html>
<?php
}
else {
echo "ERROR, wrong username or password";
}
?>