460 lines
8.1 KiB
PHP
460 lines
8.1 KiB
PHP
<?php
|
|
|
|
// make sure services can get in here
|
|
|
|
ob_start();
|
|
|
|
|
|
|
|
//$_COOKIE['age_verification']=1;
|
|
|
|
//$_GET['age_verification']=1;
|
|
|
|
echo 'Success.';
|
|
|
|
|
|
|
|
|
|
|
|
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_segpay", "a+");
|
|
|
|
if(!$handle) :
|
|
|
|
//echo "Error opening file.\n";
|
|
|
|
mail("leprakhauns@gmail.com", "Error Segpay", "Error opening file.\n");
|
|
|
|
endif;
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($_GET['approved']=="Yes"){echo "r";
|
|
|
|
if($_GET["action"]=="Auth")
|
|
{echo "T";
|
|
if($_GET["refundreasoncode"]==""){
|
|
|
|
if($_GET) :
|
|
|
|
/*if(! fwrite($handle,"APPROVED: \n". print_r($_GET, TRUE) . "\n\n\n")) :
|
|
|
|
//echo 'Error writing file.';
|
|
|
|
mail("leprakhauns@gmail.com", "Error Segpay", "Error writing file.\n");
|
|
|
|
|
|
|
|
endif;
|
|
*/
|
|
|
|
|
|
$x=explode(":", $_GET["eticketid"]);
|
|
|
|
|
|
|
|
$subscription_type = $_GET["subscription_type"];
|
|
|
|
$user_id = $_GET['seuser'];
|
|
|
|
$subscription_id = $_GET['purchaseid'];
|
|
|
|
//echo "User: ".$user_id."<br />Subscription type: ". $subscription_type."<br /> Subscription ID: ". $subscription_id ;
|
|
|
|
switch($subscription_type) :
|
|
|
|
case '20139' : # $15 -> 90-day recurring
|
|
|
|
$plan_id = '1';
|
|
|
|
$recurring = TRUE;
|
|
|
|
break;
|
|
case '27396' : # $15 -> 90-day recurring
|
|
|
|
$plan_id = '1';
|
|
|
|
$recurring = TRUE;
|
|
|
|
break;
|
|
|
|
case '0000005066' :
|
|
|
|
$plan_id = '1';
|
|
|
|
$recurring = TRUE;
|
|
|
|
break;
|
|
|
|
case '20141' : # $25 -> 180-day
|
|
|
|
$plan_id = '2';
|
|
|
|
$recurring = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case '20140' : # $45 -> 365-day
|
|
|
|
$plan_id = '3';
|
|
|
|
$recurring = FALSE;
|
|
|
|
break;
|
|
|
|
case '24603' : # $45 -> 365-day
|
|
|
|
$plan_id = '3';
|
|
|
|
$recurring = FALSE;
|
|
|
|
break;
|
|
case '28103' : # $45 -> 365-day
|
|
|
|
$plan_id = '3';
|
|
|
|
$recurring = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case '20142' : # $15 -> 90-day non-recurring
|
|
|
|
$plan_id = '6';
|
|
|
|
$recurring = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
case '23501' : # $15 -> 90-day non-recurring
|
|
|
|
$plan_id = '9';
|
|
|
|
$recurring = TRUE;
|
|
|
|
break;
|
|
|
|
case '24623' : # $15 -> 90-day non-recurring
|
|
|
|
$plan_id = '9';
|
|
|
|
$recurring = TRUE;
|
|
|
|
break;
|
|
|
|
case '23791' : # $15 -> 30-day recurring
|
|
|
|
$plan_id = '10';
|
|
|
|
$recurring = TRUE;
|
|
|
|
break;
|
|
case '27395' : # $15 -> 30-day recurring
|
|
|
|
$plan_id = '10';
|
|
|
|
$recurring = TRUE;
|
|
|
|
break;
|
|
|
|
case '24602' : # $15 -> 30-day recurring
|
|
|
|
$plan_id = '10';
|
|
|
|
$recurring = TRUE;
|
|
|
|
break;
|
|
|
|
case '24601' : # $15 -> 30-day non-recurring
|
|
|
|
$plan_id = '11';
|
|
|
|
$recurring = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
endswitch;
|
|
|
|
|
|
|
|
$plan = new semods_plan($plan_id, $user_id);
|
|
var_export($plan); exit;
|
|
/* 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[0]['userplan_plan_id']==4&&$user_plan_rows[0]['userplan_state']!=2)
|
|
{
|
|
mail("leprakhauns@gmail.com", "Trial User paid money", $user_plan_rows[0]['userplan_user_id']);
|
|
}
|
|
|
|
if(!$user_plan_rows) :
|
|
|
|
$plan->plan_exists = FALSE;
|
|
|
|
$userplan = $plan->plan_subscribe($user_id, 0, array('cc_id' => $subscription_id), $recurring, 'Segpay');
|
|
|
|
mail($recepient_info['admin_email'], "Check this user 1", "https://bateworld.com/bwadmin/admin_viewusers.php?id=".$user_id."
|
|
|
|
Subscription ID: ".$subscription_id);
|
|
|
|
|
|
|
|
|
|
|
|
elseif($user_plan_rows[0]['userplan_plan_id'] == $plan_id) :
|
|
if($user_plan_rows[0]['userplan_plan_id']==4&&$user_plan_rows[0]['userplan_state']!=2)
|
|
{
|
|
mail("leprakhauns@gmail.com", "This doesn't make sense?", $user_plan_rows[0]['userplan_user_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, 'Segpay');
|
|
|
|
mail($recepient_info['admin_email'], "Check this user 2", "https://bateworld.com/bwadmin/admin_viewusers.php?id=".$user_id."
|
|
|
|
Subscription ID: ".$subscription_id);
|
|
|
|
|
|
|
|
|
|
|
|
}else{$plan->plan_extend();
|
|
|
|
|
|
|
|
|
|
|
|
// 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{
|
|
if($plan->userplan_info['userplan_user_id']==""||$plan->userplan_info['userplan_user_id']==NULL)
|
|
{
|
|
$plan->userplan_info['userplan_user_id']=$user_id;
|
|
}
|
|
$plan->plan_extend();
|
|
mail($recepient_info['admin_email'], "Check this user 4", "Subscription ID: ".$subscription_id."
|
|
|
|
https://bateworld.com/bwadmin/admin_viewusers.php?id=".$user_id."
|
|
|
|
UPDATE se_users SET user_level_id = 2 WHERE user_id = {$plan->userplan_info['userplan_user_id']} ");
|
|
|
|
$plan->upgrade1();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$t="XXX";
|
|
|
|
|
|
|
|
}
|
|
|
|
else :
|
|
if($user_plan_rows[0]['userplan_plan_id']==4&&$user_plan_rows[0]['userplan_state']!=2)
|
|
{
|
|
mail("leprakhauns@gmail.com", "Plan subscribe, not plan extend?", $user_plan_rows[0]['userplan_user_id']);
|
|
}
|
|
$plan->plan_exists = FALSE;
|
|
|
|
$userplan = $plan->plan_subscribe($user_id, 0, array('cc_id' => $subscription_id), $recurring, 'Segpay');
|
|
|
|
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";
|
|
|
|
if($user_plan_rows[0]['userplan_plan_id']==4&&$user_plan_rows[0]['userplan_state']!=2)
|
|
{
|
|
mail("leprakhauns@gmail.com", "Trial User paid money2", "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=$_GET['purchaseid'];
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//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";
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|