Пример #1
0
 $db->query("SELECT * FROM blackjack WHERE game_id = {$player->game_id} AND " . "account_id = {$player->account_id}");
 if ($db->next_record()) {
     $old_card = unserialize($db->f("last_hand"));
 }
 if ($old_card == $player_card) {
     print_error("You can't keep the same cards twice! Note:Next time your account will be logged!");
     return;
 }
 $db->query("REPLACE INTO blackjack (game_id, account_id, last_hand) VALUES " . "({$player->game_id}, {$player->account_id}, '" . serialize($player_card) . "')");
 //heres the Banks cards
 $i = 1;
 if (sizeof($player_card) == 2 && get_value($player_card) == 21) {
     //do nothing
 } else {
     while (get_value($ai_card) < 17) {
         $ai_curr_card = draw_card($cards, $decks);
         $ai_card[] = $ai_curr_card;
         $cards[] = $ai_curr_card;
         if (sizeof($cards) >= $max_cards) {
             $cards = array();
         }
     }
 }
 $win = check_for_win(get_value($ai_card), get_value($player_card));
 if ($win == "yes" || $win == "bj") {
     print "<div align=center><h1><font color=red>You Win</font></h1></div>";
 } elseif ($win == "tie") {
     print "<div align=center><h1><font color=red>TIE Game</font></h1></div>";
 } else {
     print "<div align=center><h1><font color=red>Bank Wins</font></h1></div>";
 }
Пример #2
0
    if ($do == 'STAY' || get_value($player_card) == 21) {
        $db->query('SELECT * FROM blackjack WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
					AND account_id = ' . $db->escapeNumber($player->getAccountID()));
        if ($db->nextRecord()) {
            $old_card = $db->getObject('last_hand');
            if ($old_card == $player_card) {
                create_error('You can\'t keep the same cards twice! Note:Next time your account will be logged!');
            }
        }
        $db->query('REPLACE INTO blackjack (game_id, account_id, last_hand) VALUES
					(' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeObject($player_card) . ')');
        //heres the Banks cards
        $i = 1;
        if (!(sizeof($player_card) == 2 && get_value($player_card) == 21)) {
            while (get_value($ai_card) < 17) {
                $ai_curr_card = draw_card($decks, $cards);
                $ai_card[] = $ai_curr_card;
                $cards[] = $ai_curr_card;
                if (sizeof($cards) >= $max_cards) {
                    $cards = array();
                }
            }
        }
        $win = check_for_win(get_value($ai_card), get_value($player_card));
        if ($win == 'yes' || $win == 'bj') {
            $message .= '<div align=center><h1><span class="red">You Win</span></h1></div>';
        } elseif ($win == 'tie') {
            $message .= '<div align=center><h1><span class="red">TIE Game</span></h1></div>';
        } else {
            $message .= '<div align=center><h1><span class="red">Bank Wins</span></h1></div>';
        }
Пример #3
0
$captcha = new captcha();
// vérif captcha
if ($captcha->get() != $_REQUEST['captcha']) {
    die('code invalide, utilisez le bouton "précédent" de votre navigateur pour corriger le code');
} else {
    $captcha->reset();
    $from_email = $_SESSION['ecard']['from_email'];
    $from_name = $_SESSION['ecard']['from_name'];
    $to_email = $_SESSION['ecard']['to_email'];
    $subject = 'Voici une carte postale';
    $message = $_SESSION['ecard']['message'] . ' - ' . $_SESSION['ecard']['from_name'] . ' (' . $_SESSION['ecard']['from_email'] . ') ';
    $image = $thinkedit->newFilesystem();
    $image->setPath($_SESSION['ecard']['image']);
    $template = $thinkedit->newFilesystem();
    $template->setPath($_SESSION['ecard']['template']);
    $ecard_attachement = draw_card($message, $template->getRealPath(), $image->getRealPath(), true);
    // fabrique le mail
    require_once 'class.phpmailer.php';
    $mail = new PHPMailer();
    $mail->isHtml(true);
    $mail->CharSet = 'utf-8';
    clean($from_email);
    clean($from_name);
    clean($to_email);
    clean($subject);
    if (!empty($from_name)) {
        $subject .= ' de ' . substr($from_name, 0, 50);
    }
    $text_message = '';
    $text_message .= '<center>';
    $text_message .= " Pour envoyer une carte, il suffit d'aller sur ";
include_once 'ecard_functions.php';
if (isset($_SESSION['ecard']['message'])) {
    $message = $_SESSION['ecard']['message'] . ' - ' . $_SESSION['ecard']['from_name'] . ' (' . $_SESSION['ecard']['from_email'] . ') ';
} else {
    $message = 'pas de message';
}
if (isset($_REQUEST['image'])) {
    // mise en session de l'image
    $_SESSION['ecard']['image'] = $_REQUEST['image'];
    $image = $thinkedit->newFilesystem();
    $image->setPath($_REQUEST['image']);
} elseif (isset($_SESSION['ecard']['image'])) {
    $image = $thinkedit->newFilesystem();
    $image->setPath($_SESSION['ecard']['image']);
} else {
    die('pas d\'image demandée');
}
// idem pour le template
if (isset($_REQUEST['template'])) {
    // mise en session de l'image
    $_SESSION['ecard']['template'] = $_REQUEST['template'];
    $template = $thinkedit->newFilesystem();
    $template->setPath($_REQUEST['template']);
} elseif (isset($_SESSION['ecard']['template'])) {
    $template = $thinkedit->newFilesystem();
    $template->setPath($_SESSION['ecard']['template']);
} else {
    die('pas de template demandé');
}
draw_card($message, $template->getRealPath(), $image->getRealPath());