158 lines
5.6 KiB
PHP
158 lines
5.6 KiB
PHP
<?php
|
|
// make sure services can get in here
|
|
ob_start();
|
|
mail("mike@bateworld.com", "Helping Hands Approved", "Username: ".$_POST["donation_options"]."
|
|
".$_POST["anonymous"]."
|
|
".$_POST["recipient"]);
|
|
|
|
|
|
exit;
|
|
//$_COOKIE['age_verification']=1;
|
|
//$_GET['age_verification']=1;
|
|
echo '<html><head><title>Success</title></head><body>Success.</body></html>';
|
|
|
|
include "header2.php";
|
|
|
|
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING );
|
|
|
|
$recepient_info = $database->database_fetch_assoc($database->database_query("SELECT admin_email, admin_name FROM se_admins ORDER BY admin_id ASC LIMIT 1"));
|
|
//mail("bateworldhelp@gmail.com", "Check this user test", "User ID: ".$user_id."
|
|
//Subscription ID: ".$subscription_id);
|
|
|
|
|
|
$handle = fopen("../cc_log", "a+");
|
|
if(!$handle) :
|
|
echo "Error opening file.\n";
|
|
endif;
|
|
|
|
|
|
if($_POST) :
|
|
|
|
//mail("leprakhauns@gmail.com", "Page Hit",$_POST['subscription_id']);
|
|
if(! fwrite($handle,"APPROVED: \n". print_r($_POST, TRUE) . "\n\n\n")) :
|
|
echo 'Error writing file.';
|
|
|
|
endif;
|
|
|
|
$subscription_type = $_POST['typeId'];
|
|
$user_id = $_POST['seUser'];
|
|
$subscription_id = $_POST['subscription_id'];
|
|
echo "User: ".$user_id."<br />Subscription type: ". $subscription_type."<br /> Subscription ID: ". $subscription_id ;
|
|
switch($subscription_type) :
|
|
case '0000000217' : # $15 -> 90-day recurring
|
|
$plan_id = '1';
|
|
$recurring = TRUE;
|
|
break;
|
|
|
|
|
|
endswitch;
|
|
exit;
|
|
$plan = new semods_plan($plan_id, $user_id);
|
|
/* Query to see if plan exists for user */
|
|
$user_plan_rows = semods::db_query_assoc_all("SELECT *
|
|
FROM se_semods_userplans UP
|
|
LEFT JOIN se_semods_plans P
|
|
ON UP.userplan_plan_id = P.plan_id
|
|
WHERE userplan_user_id = $user_id order by userplan_id DESC LIMIT 1
|
|
");
|
|
|
|
|
|
if(!$user_plan_rows) :
|
|
$plan->plan_exists = false; echo"SSSS";
|
|
$userplan = $plan->plan_subscribe($user_id, 0, array('cc_id' => $subscription_id), $recurring, 'CCBill');
|
|
mail($recepient_info['admin_email'], "Check this user 1", "Subscription ID: ".$subscription_id."
|
|
|
|
https://bateworld.com/bwadmin/admin_viewusers.php?id=".$user_id);
|
|
|
|
elseif($user_plan_rows[0]['userplan_plan_id'] == $plan_id) :
|
|
if($recurring==false)
|
|
{
|
|
if($user_plan_rows[0]['userplan_expiredate']<time()){$user_plan_rows=false;
|
|
$userplan = $plan->plan_subscribe($user_id, 0, array('cc_id' => $subscription_id), $recurring, 'CCBill');
|
|
mail($recepient_info['admin_email'], "Check this user 2", "Subscription ID: ".$subscription_id."
|
|
|
|
https://bateworld.com/bwadmin/admin_viewusers.php?id=".$user_id);
|
|
|
|
|
|
}else{$plan->plan_extend(); echo "TTT";
|
|
|
|
|
|
// SEND MAIL
|
|
mail($recepient_info['admin_email'], "Check this user 3", "Subscription ID: ".$subscription_id."
|
|
|
|
https://bateworld.com/bwadmin/admin_viewusers.php?id=".$user_id);
|
|
|
|
}
|
|
}else{$plan->plan_extend();
|
|
$plan->upgrade1();
|
|
mail($recepient_info['admin_email'], "Check this user 4", "Subscription ID: ".$subscription_id."
|
|
|
|
https://bateworld.com/bwadmin/admin_viewusers.php?id=".$user_id);
|
|
|
|
$t="XXX";
|
|
|
|
}
|
|
else :
|
|
$plan->plan_exists = false; echo "PPPPP";
|
|
$userplan = $plan->plan_subscribe($user_id, 0, array('cc_id' => $subscription_id), $recurring, 'CCBill');
|
|
mail($recepient_info['admin_email'], "Check this user 5", "Subscription ID: ".$subscription_id."
|
|
|
|
https://bateworld.com/bwadmin/admin_viewusers.php?id=".$user_id);
|
|
|
|
$original_expire = $user_plan_rows[0]['userplan_expiredate'];
|
|
if($original_expire > time()) :
|
|
// Grab time between original expiration and the current time.
|
|
// Affix that, and the plan period, to current time.
|
|
$plan_length_in_s = $plan->plan_info['plan_period'] * 86400;
|
|
$new_expire = ($original_expire - time()) + $plan_length_in_s + time();
|
|
$expire_sql = "UPDATE se_semods_userplans SET userplan_expiredate = $new_expire WHERE userplan_user_id = $user_id";
|
|
fwrite($handle,"SQL: \n". $expire_sql . " \n\nORIGINAL EXPIRE: $original_expire \n\nPLAN LENGTH: $plan_length_in_s \n\n\n");
|
|
if(!semods::db_query($expire_sql)) :
|
|
if(! fwrite($handle,"ERROR WRITING SQL TO RENEW MEMBER: \n". date('y-m-d') . "\n\n\n")) :
|
|
echo 'Error writing file.';mail("leprakhauns@gmail.com", "ERROR WRITING FILE", "Error writing file on ERROR WRITING SQL TO RENEW MEMBER");
|
|
endif;
|
|
if($t=="XXX"){
|
|
mail("leprakhauns@gmail.com", "IIIII","");
|
|
}
|
|
endif;
|
|
|
|
if($t=="XXX"){
|
|
mail("leprakhauns@gmail.com", "AAAAAAA","");
|
|
}
|
|
endif;
|
|
|
|
if($t=="XXX"){
|
|
mail("leprakhauns@gmail.com", "LLLLLLLLLLL","");
|
|
}
|
|
endif;
|
|
|
|
else :
|
|
if($t=="XXX"){
|
|
mail("leprakhauns@gmail.com", "KKKKKKKKKKKKKK","");
|
|
}
|
|
if(! fwrite($handle,"ACCESS: \n". date('y-m-d') . "\n\n\n")) :
|
|
echo 'Error writing file.';
|
|
mail("leprakhauns@gmail.com", "ERROR WRITING FILE", "Error writing file on Access");
|
|
endif;
|
|
|
|
if($t=="XXX"){
|
|
mail("leprakhauns@gmail.com", "SSSSSSSSSSSSSS","");
|
|
}
|
|
endif;
|
|
|
|
if($t=="XXX"){
|
|
|
|
}
|
|
|
|
//$x=ob_get_contents();
|
|
//mail("leprakhauns@gmail.com", "CCBill Tracking", $x);
|
|
//check for Wayne
|
|
// removed on 10/18/2015 aat 6 PM MT
|
|
// test to see if duplicate email being sent - phil 10/22/2015
|
|
$x=$_POST['subscription_id'];
|
|
//mail("porembaphilip@gmail.com", "CCBill Tracking", $x); Removed 03/02 by phil - terminating work on email - this was to eliminate inundating costomers with duplicate emails with CCBill's system acted up.
|
|
include "footer-nooutput.php";
|
|
|
|
|
|
?>
|