function CheckUserExpiration() { $this->showClass = ""; $this->trialTimeClass = "none"; $this->showData = true; $paymentDates = payment_info::getPaymentDates($this->userId); $this->trialMessage = ""; $lastPaymentDate = ""; $nextPaymentDate = ""; $useSubscriptionText = true; $expirationInfo = user::getUserExpirationDate($this->userId); $expDate = new DateTime($expirationInfo['date']); $now = new DateTime(date("Y-m-d")); $diff = intval($now->diff($expDate)->format("%r%a")); $nextPaymentDate = $expDate->format("F dS, Y"); $isTrial = $expirationInfo['type'] == user::EXP_TYPE_TRIAL; if ($isTrial) { $useTrialEnd = true; if ($diff < 0) { $this->trialTimeClass = ""; $this->trialMessage = "**** YOUR TRIAL MEMBERSHIP HAS EXPIRED! ****"; $this->showData = false; $this->showClass = "none"; } else { if ($diff <= 15) { $this->trialTimeClass = ""; if ($diff == 0) { $this->trialMessage = "**** TRIAL MEMBERSHIP EXPIRES TODAY! ****"; } else { $this->trialMessage = "**** TRIAL MEMBERSHIP EXPIRES IN " . $diff . " DAYS! ****"; } } } } else { if ($diff >= -3) { $useSubscriptionText = false; } else { $this->trialTimeClass = ""; $this->trialMessage = "**** YOUR SUBSCRIPTION HAS EXPIRED! ****"; $this->showData = false; $this->showClass = "none"; } } $this->useSubscriptionText = $useSubscriptionText; $this->nextPaymentDate = $nextPaymentDate; }
$admin = new admins(); $admin->set_variable('admin_user_id', $uid); $isAdmin = false; $showToAdminClass = ''; if ($admin->load()) { $isAdmin = true; $showToAdminClass = ''; } if (isset($_GET['lo'])) { session_destroy(); header('Location: /'); } $showClass = ""; $trialTimeClass = "none"; $showData = true; $paymentDates = payment_info::getPaymentDates($uid); $trialMessage = ""; $lastPaymentDate = ""; $nextPaymentDate = ""; $useSubscriptionText = true; $expirationInfo = user::getUserExpirationDate($uid); $expDate = new DateTime($expirationInfo['date']); $now = new DateTime(date("Y-m-d")); $diff = intval($now->diff($expDate)->format("%r%a")); $nextPaymentDate = $expDate->format("F dS, Y"); $isTrial = $expirationInfo['type'] == user::EXP_TYPE_TRIAL; if ($isTrial) { $useTrialEnd = true; if ($diff < 0) { $trialTimeClass = ""; $trialMessage = "**** YOUR TRIAL MEMBERSHIP HAS EXPIRED! ****";
$paypalTxn->set_variable('bp_paypal_txn_id', $_POST['txn_id']); $paypalTxn->set_variable('bp_paypal_txn_type', $_POST['txn_type']); $paypalTxn->set_variable('bp_paypal_username', $_POST['username']); $paypalTxn->set_variable('bp_paypal_mc_gross ', $_POST['mc_gross']); $paypalTxn->set_variable('bp_paypal_option_name', $_POST['option_name1']); $paypalTxn->set_variable('bp_paypal_option_selection', $_POST['option_selection1']); $paypalTxn->set_variable('bp_paypal_email', $_POST['payer_email']); $paypalTxn->set_variable('bp_paypal_mc_fee ', $_POST['mc_fee']); $paypalTxn->set_variable('bp_paypal_zip', $_POST['address_zip']); $paypalTxn->set_variable('bp_payment_status', $_POST['payment_status']); $paydate = $_POST['payment_date']; $timestamp = date('Y-m-d', strtotime($paydate)); $paypalTxn->set_variable('bp_payment_date', $timestamp); $paypalTxn->createNew(); } $debugString .= "\nProcessed\n"; // } if (strcmp($res, "INVALID") == 0) { $debugString .= "\nINVALID - DON'T KNOW WHY!!!\n"; $debugString .= "\nRECEIVED: " . print_r($raw_post_array, true); $raw_post_array = explode('&', $req); $debugString .= "\n SEND BACK: " . print_r($raw_post_array, true); $debugString .= "\nREPLY FROM PAYPAL::" . $res; } // try to resolve this or any other outstanding payment ids payment_info::reconcileAllPaymentUids(); $my_file = 'debug.txt'; $handle = fopen($my_file, 'w') or die('Cannot open file: ' . $my_file); //implicitly creates file fwrite($handle, $debugString); fclose($handle);
public static function getUserExpirationDateTEST($uid) { $paymentDates = payment_info::getPaymentDates($uid); $paymentDate = date('0-0-00'); $expiration = array(); if (!empty($paymentDates)) { $paymentDate = $paymentDates['next']->format("Y-m-d"); } $trialDate = date('0-0-00'); $manualExpDate = date('0-0-00'); $user = new user(); $user->set_variable('users_id', $uid); if ($user->load()) { $created = new DateTime($user->get_variable('users_creationdate')); $created->add(new DateInterval('P' . user::TRIAL_PERIOD . 'D')); $trialDate = $created->format('F j, Y'); $manualExpDate = $user->get_variable('users_manualexpdate'); } if (!empty($paymentDates)) { $datetime = strtotime($paymentDate); $expiration['date'] = date("F j, Y", $datetime); $expiration['type'] = user::EXP_TYPE_PAID; } return $expiration; }