コード例 #1
0
ファイル: products.php プロジェクト: DbyD/cruk
		<span class="helper"></span>
		<img src="<?php 
echo HTTP_PATH;
?>
images/our-heroes.svg" alt="Cancer Research UK" />
	</div>
	<div id="awards" class="callout panel">
		<div class="title">
			<!-- <i class="icon-icons_trophy"></i> --> 
			Available to spend
		</div>
		<div class="price-panel">
			<!-- <i class="icon-icons_trophy"></i> -->
			<?php 
$sum_all = getAvailable($_SESSION['user']->EmpNum);
$sum_credit_card = getCreditCard($_SESSION['user']->EmpNum);
$sum_orders = getEmpBasketOrdersSum($_SESSION['user']->EmpNum);
$remaining_amount = $sum_all + $sum_credit_card - $sum_orders;
echo '&pound;' . ' ' . $remaining_amount;
?>
		</div>
		<div class="unlaimed-panel">
			<!-- <i class="icon-icons_trophy"></i> --> 
			+2 Unclaimed
		</div>
	</div>
	<div  class="callout panel" id="menu_container">
		<?php 
$menu->db = $db;
echo $menu->Menu();
?>
コード例 #2
0
$user_id = $_SESSION['user_id'];
if (!$user_id) {
    header('Location: ' . $baseurl . '#login');
    exit;
}
$cpid = isset($_POST['cpid']) ? $_POST['cpid'] : 0;
$cc_id = isset($_POST['cc_id']) ? $_POST['cc_id'] : 0;
$bill_id = isset($_POST['bill_id']) ? $_POST['bill_id'] : 0;
$cc_cvc = isset($_POST['cc_cvc']) ? $_POST['cc_cvc'] : 0;
$ret = false;
if (!$cc_id or !$cc_id or !$bill_id) {
    header('Location: ' . $baseurl . '/balance.php');
    exit;
}
$cp = getCoinPackage($cpid);
$cc = getCreditCard($cc_id);
$bi = getBillAddress($bill_id);
$tax = $cp['cpamount'] * ($config['sale_tax'] / 100);
$order_total = $cp['cpamount'] - $tax;
$coin_amount = $cp['cpcoin'];
$tx_method = 'cc';
$ret = buyCoin($user_id, $cc_id, $bill_id, $cpid, $tx_method, $order_total, $coin_amount, $cc_cvc);
if ($ret['status'] == 'error') {
    // redirect to error page
    exit;
}
$homemenu = 'active';
?>
<!DOCTYPE HTML>
<html>
<?php 
コード例 #3
0
 // Sign in form postback
 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
     // Confirm that the user has provided the correct current password
     if (validateLogin($_POST['user']['email'], $_POST['user']['current_password'])) {
         $creditCardId = NULL;
         $newPassword = NULL;
         $newCard = array_map('trim', $_POST['user']['credit_card']);
         $newValues = count(array_filter($newCard, 'strlen'));
         // Update credit card info if new credit card data has been provided
         if ($newValues > 0 && $newValues < 5) {
             $message = "Please fill in all required credit card values.";
             $messageType = "error";
         } else {
             if ($newValues == 5) {
                 $creditCardId = saveCard($newCard);
                 $card = getCreditCard($creditCardId);
             }
         }
         // Update password if new password data has been provided
         if (isset($_POST['user']['password'])) {
             if ($_POST['user']['password'] == $_POST['user']['password_confirmation']) {
                 $newPassword = $_POST['user']['password'];
             } else {
                 $message = "The new password did not match your confirm password.";
                 $messageType = "error";
             }
         }
         // update credit card info OR/AND password in our database
         if (!isset($message) && (isset($newPassword) || isset($creditCardId))) {
             updateUser($_POST['user']['email'], $newPassword, $creditCardId);
             $message = "Your profile has been updated.";
コード例 #4
0
ファイル: cron.php プロジェクト: DbyD/cruk
*/
if (isset($_POST['unspent_award'])) {
    if (quarterCheck()) {
        //For each employee check if he has an approved award
        //received more then 3 months ago
        $employees = $db->prepare("SELECT * FROM tblempall");
        $employees->execute();
        while ($employee = $employees->fetch(PDO::FETCH_OBJ)) {
            //get his approved awards that are older then 3 months
            $awards = $db->prepare("SELECT COUNT(*) as Count FROM tblnominations WHERE NominatedEmpNum LIKE :EmpNum AND AprStatus LIKE '1' AND AprDate < NOW() - INTERVAL 3 MONTH");
            $awards->execute(array(':EmpNum' => $employee->EmpNum));
            $awards = $awards->fetch(PDO::FETCH_OBJ);
            if ($awards->Count > 0) {
                //calculate the user's remaining amount
                $sum_all = getAvailable($employee->EmpNum);
                $sum_credit_card = getCreditCard($employee->EmpNum);
                $sum_orders = getEmpBasketOrdersSum($employee->EmpNum);
                $remaining_amount = $sum_all + $sum_credit_card - $sum_orders;
                if ($remaining_amount > 0) {
                    //shoot him an email
                    $email = new StdClass();
                    $email->emailTo = $employee->Eaddress;
                    $email->subject = "CRUK Website Unspent Amount Reminder";
                    $email->Content = '<p>Hi ' . $employee->Fname . '<p>
										<pYou have money in your account to spend!</p>';
                    sendEmail($email);
                }
            }
        }
    }
}