-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbook.php
More file actions
189 lines (153 loc) · 4.91 KB
/
book.php
File metadata and controls
189 lines (153 loc) · 4.91 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
<!DOCTYPE html>
<!-- saved from url=(0034)http://localhost/mysite/Home.html# -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<style>
* {
box-sizing: border-box;
}
body {
font-family: Monotype Corosiva;
padding: 20px;
background: #F5B7B1 ;
}
/* Header/Blog Title */
.header {
padding: 40px;
font-size: 60px;
text-align: right;
background: #008080 url("https://i2.wp.com/hbgmedicalassistance.com/wp-content/uploads/2015/07/fortis-hospital-logo.jpg?w=700") no-repeat local top left;
}
/* Style the top navigation bar */
.topnav {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: red;
font-family: Arial, Helvetica, sans-serif;
}
/* Style the topnav links */
.topnav a {
display: block;
color: white;
text-align: center;
padding: 20px 16px;
text-decoration: none;
float: left;
}
/* Change color on hover */
.topnav a:hover {
background-color: #111;
}
/* Create two unequal columns that floats next to each other */
/* Left column */
.leftcolumn {
float: left;
width: 75%;
}
/* Right column */
.rightcolumn {
float: left;
width: 25%;
background-color: #f1f1f1;
padding-left: 20px;
}
/* Fake image */
.fakeimg {
width: 100%;
}
/* Add a card effect for articles */
.card {
background-color: #D1F2EB;
padding: 20px;
margin-top: 20px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Footer */
.footer {
padding: 20px;
text-align: center;
background: #ddd;
margin-top: 20px;
}
/* Responsive layout - when the screen is less than 800px wide, make the two columns stack on top of each other instead of next to each other */
@media (max-width: 800px) {
.leftcolumn, .rightcolumn {
width: 100%;
padding: 0;
}
}
/* Responsive layout - when the screen is less than 400px wide, make the navigation links stack on top of each other instead of next to each other */
@media (max-width: 400px) {
.topnav a {
float: none;
width:100%;
}
}
</style>
<body>
<div class="header">
<h2>APOLLO FORTIS</h2>
</div>
<div class="topnav">
<a href="http://localhost/mysite/patientHome.html">Home</a>
<a href="http://localhost/mysite/pHistory.html">History</a>
<a href="http://localhost/mysite/Application.php">Appointment</a>
<a href="http://localhost/mysite/pAchievements.html">Achievements</a>
<a href="http://localhost/mysite/logout.php" style="float:right">Logout</a>
</div>
<?php
session_start();
$connection = mysqli_connect("localhost", "root", ""); // Establishing Connection with Server
$db = mysqli_select_db($connection,"testdb"); // Selecting Database from Server
if(isset($_POST['submit'])){ // Fetching variables of the form which travels in URL
$name=htmlspecialchars($_SESSION['username']);
$depno = $_POST['depname'];
$docno = $_POST['docname'];
$date =$_POST['date'];
$time=htmlspecialchars($_POST['time']);
$reason = htmlspecialchars($_POST['reason']);
$mydepname=mysqli_query($connection,"SELECT deptname FROM department WHERE deptid=$depno");
$id3=mysqli_fetch_row($mydepname);
$depname=$id3[0];
$mydocname=mysqli_query($connection,"SELECT docname FROM department WHERE deptid=$depno AND deptname='$depname'" );
$id4=mysqli_fetch_row($mydocname);
$docname=$id4[0];
$result = mysqli_query($connection,"SELECT * FROM department WHERE deptid=$depno AND docid=$docno AND '".$time."' BETWEEN startTime AND endTime");
$id2 = mysqli_fetch_row($result);
$addup = '00:30';
//var_dump($id2);
if(empty($id2)){
echo("Slot is not available.Please select other slot. " );
echo ('<a href="http://localhost/mysite/Application.php">Click here</a>');
}
else{
$secs = strtotime($addup)-strtotime("00:00");
$result = date("H:i",strtotime($time)+$secs);
if($date !=''&&$reason !=''&&$time !=''){
//Insert Query of SQL
$query = mysqli_query($connection,"insert into bookappointment values ('$depname', '$docname', '$date', '$reason','$time','$name')");
echo "<br/><br/><span>Appointment process successful...!!</span>";
echo("Your appointment slot has been booked from time " .$time." to ".$result);
}
else{
echo "<p>Insertion Failed <br/> Some Fields are Blank....!!</p>";
}
}
$startTime = mysqli_query($connection,"SELECT startTime FROM department WHERE docname='$docname'");
$id = mysqli_fetch_row($startTime);
$stime=$id[0];
$endTime = mysqli_query($connection,"SELECT endTime FROM department WHERE docname='$docname'");
$id1 = mysqli_fetch_row($endTime);
$etime=$id1[0];
echo("<br/><br/>Doctors consultation time is from " .$stime." to ".$etime);
}
mysqli_close($connection); // Closing Connection with Server
?>
</body>
</html>