-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchForDoctorsFnc.php
66 lines (54 loc) · 2.04 KB
/
SearchForDoctorsFnc.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
<?php
include('config.php');
include('loginfirst.php');
if (!array_key_exists("loginalertmsg",$_SESSION)) {
$_SESSION['loginalertmsg'] = '';
}
?>
<?php
//Check wheather All details were entered
if (isset($_POST['docUsername']) and isset($_POST['reservationDate'] )) {
$docUserName = $_POST['docUsername'];
$reservationDate = $_POST['reservationDate'];
$username = $_SESSION['username'];
}else{
$_SESSION['searchalertmsg'] = "Enter complete Details";
header("Location: SearchForDoctors.php"); die();
}
//Check wheather is a date is correct?
$today_start = strtotime('today');
$date_timestamp = strtotime($reservationDate);
$mints = $date_timestamp - $date_timestamp%86400 + 86400;
$maxts = $mints + 86400;
echo $date_timestamp." ".$mints." ".$maxts;
if ($date_timestamp < $today_start) {
$_SESSION['searchalertmsg'] = "Enter a correct Date";
header("Location: SearchForDoctors.php"); die();
}
//Check wheather is the Doctors is available on the given date
$query1 = "SELECT * FROM docappointment WHERE username='$docUserName' AND '$mints' < appointmentfrom AND '$maxts' > appointmentfrom";
// AND '$mints' < appointmentfrom AND '$maxts' > appointmentfrom
$result1 = $mysqli->query($query1);
$numRows1 = mysqli_num_rows($result1);
if($result1 and mysqli_num_rows($result1)>0 ){
/*$resultSet1 = mysqli_fetch_assoc($result1);
$maxNo = $resultSet1['maxnoofpatient'];
$regNo = $resultSet1['noofregisteredpatients'];
if ($maxNo>$regNo) {
$_SESSION['searchalertmsg'] = "Doctor is Available. You can make a Reservation";
header("Location: SearchForDoctors.php"); die();
}elseif($maxNo!=NULL){
$_SESSION['searchalertmsg'] = "Doctor's Channel List is Full";
header("Location: SearchForDoctors.php"); die();
}
else{
$_SESSION['searchalertmsg'] = "Doctor is Not Available.";
header("Location: SearchForDoctors.php"); die();
} */
$_SESSION['searchalertmsg'] = "Doctor is Available.";
header("Location: SearchForDoctors.php"); die();
}else{
$_SESSION['searchalertmsg'] = "Doctor is Not Available.";
header("Location: SearchForDoctors.php"); die();
}
?>