105 lines
4.5 KiB
PHP
105 lines
4.5 KiB
PHP
<?php
|
|
ob_start();
|
|
$adminredirect=2;
|
|
header("Content-Type: text/html\n\n");
|
|
|
|
|
|
chdir('..');
|
|
$redirect=1;
|
|
include('../../admin/scripts/admin_header.php');
|
|
ini_set('display_errors', FALSE);
|
|
|
|
//mail("leprakhauns@gmail.com", "Expire Users2", $var);
|
|
$plan = new semods_plan(1, 1);
|
|
|
|
// grab the last day's worth of expiWrations
|
|
$base = 'https://datalink.ccbill.com/data/main.cgi?';
|
|
$yesterday = date("Ymd", strtotime("-1 day"));
|
|
$startTime = $yesterday . '000000';
|
|
$endTime = $yesterday . '235959';
|
|
$transactionTypes = 'EXPIRE';
|
|
$clientAccnum = '940183';
|
|
$username = 'peterr24';
|
|
$password = 'MICKEY12';
|
|
|
|
$expire_fetch_url = $base .
|
|
'startTime=' . $startTime .
|
|
'&endTime=' . $endTime .
|
|
'&transactionTypes=' . $transactionTypes .
|
|
'&clientAccnum=' . $clientAccnum .
|
|
'&username=' . $username .
|
|
'&password=' . $password;
|
|
|
|
$expired_users = file($expire_fetch_url);
|
|
# $expired_users = array('"EXPIRE","940183","0000","0110284102000000367","2010-10-10","NULL","N"');
|
|
|
|
echo "<pre>Expired users:\n";
|
|
print_r($expired_users);
|
|
echo "</pre>";
|
|
|
|
$are_expiring_members = FALSE; // only run query if there are expiring members
|
|
$subscription_id_where = " WHERE";
|
|
foreach($expired_users as $expired_user) :
|
|
preg_match('/\d{19}/', $expired_user, $subscription_id_match);
|
|
if($subscription_id_match[0]) :
|
|
$subscription_id_where .= " userplan_metadata LIKE '%${subscription_id_match[0]}%' OR ";
|
|
$are_expiring_members = TRUE;
|
|
endif;
|
|
endforeach;
|
|
$subscription_id_where .= '1=0;'; // tacked onto the WHERE ORs to avoid syntax snafu
|
|
|
|
if($are_expiring_members) :
|
|
$sql = "SELECT * FROM se_semods_userplans " . $subscription_id_where;
|
|
$expired_subscriptions = mysql_fetch_assoc(mysql_query($sql));
|
|
|
|
foreach($expired_subscriptions as $one_expired_subscription) :
|
|
$plan_to_expire = new semods_plan($one_expired_subscription['userplan_user_id'], $one_expired_subscription['userplan_plan_id']);
|
|
if($plan_to_expire->plan_exists) :
|
|
$plan_to_expire->userplan->expire_plan();
|
|
endif;
|
|
endforeach;
|
|
endif;
|
|
|
|
//mail("leprakhauns@gmail.com", "Expire Users3", $var);
|
|
/*
|
|
* WHERE for grabbing appropriate plan rows
|
|
* SELECT * FROM se_semods_userplans WHERE userplan_metadata LIKE '%0110284102000000367%';
|
|
*
|
|
*/
|
|
|
|
|
|
subscriber_scheduler_daily();
|
|
|
|
/*
|
|
* https://datalink.ccbill.com/data/main.cgi?startTime=20100901000000&endTime=20101003000000&transactionTypes=NEW,EXPIRE&clientAccnum=940183&username=peterr24&password=MICKEY12
|
|
*/
|
|
|
|
/*
|
|
|
|
File sample:
|
|
|
|
"NEW","940183","0000","0310283701000000753","20101010044319","Mr AJ le","Roux","poppersp","Expl1c1t","28 Huntstile","Goathurst","XX","TA5 2DQ","GB","antler62@gmail.com","","Y","15.00","90","15.00","90","99","VISA"
|
|
"NEW","940183","0000","0110283701000011916","20101010051505","L STEVEN","JAEGER","hangnjo","drrcjcbm","15 Ridge Dr.","Melville","NY","11747","US","hangnjo@yahoo.com","","Y","15.00","90","15.00","90","99","VISA"
|
|
"NEW","940183","0000","0210283701000006619","20101010101301","MARIOS","AIVATOGLOU","marios74","040674","Efessou 6","N.Smirni","XX","17121","GR","marios00aiv@hotmail.com","","Y","15.00","90","15.00","90","99","VISA"
|
|
"NEW","940183","0000","0210283701000006771","20101010102315","Justin","Rodriguez","jdawg069","jtotharo","1656 Sand Canyon Drive","Las Vegas","NV","89128","US","justinmrodriguez@gmail.com","","Y","45.00","365","0","0","0","VISA"
|
|
"NEW","940183","0000","0210283701000007009","20101010104202","Cirillo","Benitez","rillo420","rillo1","91 Conaskonk Circle","Royal Palm Beach","FL","33411","US","big_boy20_98@yahoo.com","","Y","15.00","90","15.00","90","99","VISA"
|
|
"NEW","940183","0000","0210283701000007236","20101010105823","Don R Day","Jr","gwinnett","31761768","3778 Creekstone Drive","Nocross","GA","30092","US","gwinnett6ft4@hotmail.com","","Y","45.00","365","0","0","0","VISA"
|
|
"NEW","940183","0000","0210283701000009463","20101010133248","David","Gaita","stroking","teacher3","10 Wampus Ave #23","Acton","MA","01720","US","teach2U1229@msn.com","","Y","15.00","90","15.00","90","99","VISA"
|
|
"NEW","940183","0000","0210283701000015072","20101010204754","Elvin","Cook","reckless","cartoon7","2004 Mimosa Trail","Round Rock","TX","78664","US","zoglet@austin.rr.com","","Y","25.00","180","0","0","0","VISA"
|
|
"NEW","940183","0000","0310283701000003432","20101010220734","Mr Kevin B","Sharp","budd44","vernon","93 Adam Street , Wynnum","Brisbane","QLD","4178","AU","womm26@me.com","","Y","45.00","365","0","0","0","VISA"
|
|
"EXPIRE","940183","0000","0210193101000013017","2010-10-10","NULL","N"
|
|
"EXPIRE","940183","0000","0210193101000022578","2010-10-10","NULL","N"
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$var = ob_get_clean();
|
|
|
|
|
|
include('../../admin/scripts/admin_footer.php');
|
|
?>
|