-
Notifications
You must be signed in to change notification settings - Fork 0
/
redeem_mobile.php
64 lines (49 loc) · 1.64 KB
/
redeem_mobile.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
<?php
require_once('includes/mysql.php');
require_once('includes/mysql_aid_functions.php');
require_once('includes/mail_aid_functions.php');
require_once('parcels/classes.php');
ini_set('max_execution_time', 3*60*60);
$files = $_POST['file'];
$filecs = $_POST['filec'];
$files = glob("MobileScan/Export*.csv");
print_r($files);
$date = $year.'-'.$month.'-15';
$qry = "UPDATE parcel_run_date SET dtt='$date' WHERE type='mobile'";
query($qry);
foreach($files as $f){
$file = basename($f);
$batch_no = mobileFileReader::getBatchNo($file);
if (($handle = fopen("MobileScan/".$file, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE){
if($data[0] != "Batch_ID"){
$ticket = new mobileTicket($data);
$ticket->redeem($batch_no, $year, $month);
}
}
fclose($handle);
}
rename("MobileScan/".$file, "MobileScan/Processed_".$file);
$MESSAGE.= "File $file processed.\n";
}
//send_mail($MESSAGE);
function send_mail($body){
$mailer = new FreakMailer();
//$mailer->SMTPKeepAlive = true;
$mailer->Subject = "Mobile Redemption run ".date("Y-m-d h:i:m");
$mailer->Body = $body;
//$mailer->From = "[email protected]";
//$mailer->SMTPDebug = 2;
//$mailer->AuthType = "NTLM";
//$mailer->SMTPSecure = "tls";
$mailer->AddAddress("[email protected]", 'Coural Head Office');
$mailer->AddAddress("[email protected]", 'Coural Head Office');
if(!$mailer->Send())
{
echo "<font color='red'>Mail to $company failed (".$email.") : ".$mailer->ErrorInfo."</font><br />";
}
else{
echo "<font color='green'>SUCCESS</font><br />";
}
}
?>