-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcron.php
69 lines (35 loc) · 1.32 KB
/
cron.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
<?php
include("PHP.php");
$getcustomer = new Database();
$query= "SELECT E_Time,NIC FROM reservation ORDER BY E_Time ASC ;";
$result = $getcustomer->Query($query) ;
date_default_timezone_set("Asia/Colombo");
if ($result) {
while ($row = mysqli_fetch_assoc($result)) {
$d=$row['E_Time'] ;
$d=date_create($d);
$time = date("Y-m-d H:i:s");
$date=date_create($time);
$h=date_diff($date,$d);
print_r($h->format("%R%i")) ;
echo '<br>';
if ($h->format("%R%i")<"+5"){
$too = $row['NIC'];
$get = new Database();
$query= "SELECT Email FROM user WHERE '$too' = NIC ;";
$result = $get->Query($query) ;
$ro = mysqli_fetch_array($result);
$to = $ro['Email'] ;
$subject = "Parking Reservation System";
$message ="Sorry ! ,Your Reservation is Expired ";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <Email>' . "\r\n"; //Email, shown as From
mail($to,$subject,$message,$headers);
echo $to;
$query= "DELETE FROM reservation WHERE NIC = '$too';";
$result = $getcustomer->Query($query) ;
}
}
}
?>