-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaskdel.php
63 lines (44 loc) · 3.51 KB
/
taskdel.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
<?php
include_once "include/config.php";
$ip = $_SERVER['SERVER_ADDR']; // the IP address to query
$query = @unserialize(file_get_contents('http://ip-api.com/php/'.$ip));
if($query && $query['status'] == 'success') {
// echo 'Hello visitor from '.$query['country'].', '.$query['city'].'!';
date_default_timezone_set($query['country']); // CDT
$currentdate = date('Y-m-d H:i');
$curtime= date('H:i:s A', time());
//$dateInTwoWeeks = date("Y-m-d H:i",strtotime("-5 hours"));
//$dateInTwoWeeks = date("Y-m-d H:i",strtotime("-2 weeks"));
$dateInTwoWeeks = date("Y-m-d H:i",strtotime("-20160 minutes"));
$secretkey = mysql_query("select * from stripecredentials where id ='1'");
$sresult = mysql_fetch_array($secretkey);
$query = mysql_query("SELECT * FROM tasks WHERE id NOT IN (SELECT task_id FROM bids) AND DATE_FORMAT(added_date,'%Y-%m-%d %H:%i')='$dateInTwoWeeks' ORDER BY `id` DESC");
while($data = mysql_fetch_array($query)){
$datacc = mysql_query("select * from tasks where id='".$data['id']."'");
$recdata = mysql_fetch_array($datacc);
$dataagain = mysql_query("select * from members where id='".$recdata['userid']."'");
$recagain = mysql_fetch_array($dataagain);
$to =$recagain['email']; // send mail to requester
// $to ='[email protected]';
$subject = "Your request ". $data['taskname']." is deleted";
$body="<table cellpadding='5px' width='600px' height='300px' style='border:1px solid #00aeec' align='center'><tr><td height='30px;' bgcolor='#fff' style='border-bottom:1px solid #00aeec'> <img src='http://ubangbangwo.com/images/logo.png' height='50'></td></tr><tr><td><h1>Dear ".$recagain['fname']." ".$recagain['lname'].",</h1><td></tr><tr><td>Sorry, Your request ". $data['taskname']." ".$curtime." is deleted by system. </td></tr><tr><td> </td></tr><tr><td>Reason- No bid on it for two weeks.</td></tr><tr><td> </td></tr><tr><td>Thanks</td></tr><tr><td>Your BangBangWo Team</td></tr></table>";
//$headers = 'MIME-Version: 1.0' . "\r\n";
//$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = 'From: [email protected].' . "\r\n" ;
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$body,$headers);
//changes : 20-08
/*$bidmultipledata = mysql_query("select * from bids where task_id='".$data['id']."'");
if(mysql_num_rows($bidmultipledata)>0)
{
mail($to,$subject,$body,$headers);
} */
mysql_query("Delete from tasks where id='".$data['id']."'");
mysql_query("Delete from bids where task_id='".$data['id']."'");
echo 'deleted';
}
} else {
echo 'Unable to get location';
}
?>