-
Notifications
You must be signed in to change notification settings - Fork 45
/
singleap.php
106 lines (77 loc) · 2.72 KB
/
singleap.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
<?php
session_start();
if(!isset($_SESSION['useremail'])){
echo "<div align='center' style='font-family : calibri; color:white; background:#D20D0D; padding:15px;'>Access denied ! </div>";
}else{
if(isset($_POST['sub'])){
$pid = $_POST['getpid'];
$did = $_POST['getdid'] ;
$pname = $_POST['pname'];
$pmob = $_POST['pmob'];
$age = $_POST['age'];
$problem = $_POST['problem'];
$date = $_POST['date'];
$time = $_POST['time'];
$rname = $_FILES['pre_report']['name'];
$type = $_FILES['pre_report']['type'];
$temp = $_FILES['pre_report']['tmp_name'];
$status = "pending";
if((strlen($pmob)<10) || (strlen($pmob)>10)){
echo '<script type="text/javascript">';
echo 'alert("Enter 10 Digit valid mobile no");';
echo '</script>';
}
elseif(strlen($age>120) || strlen($age<1)){
echo '<script type="text/javascript">';
echo 'alert("Invalid age");';
echo '</script>';
}else{
include('includes/conn.php');
$qry = "SELECT * FROM appointments WHERE doc_id='$did' AND a_time='$time' AND a_date='$date' AND status='pending' " ;
$res = mysqli_query($con,$qry);
$qrt = "SELECT * FROM appointments WHERE '$date'=CURRENT_DATE AND '$time'<CURRENT_TIME";
$rt = mysqli_query($con,$qrt);
if($res->num_rows>0){
echo '<script type="text/javascript">';
echo 'alert("Appointment Already Booked");';
echo 'window.location.href = "doclist.php";';
echo '</script>';
}elseif(date('Y-m-d') == date('Y-m-d', strtotime($date)) && $time<date('H') ){
echo '<script type="text/javascript">';
echo 'alert("Time is passed you are late");';
echo 'window.location.href = "doclist.php";';
echo '</script>';
}
else{
if(($rname !="" && $type == "application/pdf")){
$location = "./patient/reports/$pid";
$q = "INSERT into appointments values('','$pname','$pmob','$age','$date','$time','$problem','$did','$pid','$status','$location/$rname','')";
if($r = mysqli_query($con,$q)){
mkdir($location, 0777, true);
move_uploaded_file($temp, "patient/reports/$pid/$rname");
echo '<script type="text/javascript">';
echo 'alert("Redirecting you to payment page");';
echo 'window.location.href = "patient.php#viewap";';
echo '</script>';
}
}
elseif($rname ==""){
$location = "./patient/reports/$pid";
$q = "INSERT into appointments values('','$pname','$pmob','$age','$date','$time','$problem','$did','$pid','$status','','')";
if($r = mysqli_query($con,$q)){
echo '<script type="text/javascript">';
echo 'alert("Redirecting you to payment page");';
echo 'window.location.href = "patient.php#viewap";';
echo '</script>';
}
}else{
echo '<script type="text/javascript">';
echo 'alert("Not Done...");';
echo 'window.location.href = "doclist.php';
echo '</script>';
}
}
}
}
}
?>