public function writelog($devname, $operask, $operasw) { $csql = "select count(*) from operatorlog"; $loglist = $card->select($csql); $num = count($loglist); if ($num > 100000) { $card->delete("delete from operatorlog"); } $ipaddr = $this->getip(); $date = $this->gethedate(); $time = $this->gettime(); $name = $_SESSION['RBAC_PCOD']['USERNAME']; $sql = "insert into operatorlog(name,date,time,devname,ipaddr,operask,operasw) values('{$name}','{$date}','{$time}','{$devname}','{$ipaddr}','{$operask}','{$operasw}')"; $card = new card(); $card->insert($sql); }
function remove_card() { if (pc_base::load_config('system', 'safe_card') != 1) { showmessage(L('your_website_opened_the_card_no_password')); } $userid = isset($_GET['userid']) && intval($_GET['userid']) ? intval($_GET['userid']) : showmessage(L('user_id_cannot_be_empty')); $data = $result = ''; if ($data = $this->db->get_one(array('userid'=>$userid), '`card`,`username`,`userid`')) { pc_base::load_app_class('card', 'admin', 0); if ($result = card::remove_card($data['card'])) { $this->db->update(array('card'=>''), array('userid'=>$userid)); showmessage(L('the_binding_success'), '?m=admin&c=admin_manage&a=card&userid='.$userid); } } else { showmessage(L('users_were_not_found')); } }
public function public_card() { $username = $_SESSION['card_username'] ? $_SESSION['card_username'] : showmessage(L('nameerror'), HTTP_REFERER); $r = $this->db->get_one(array('username' => $username)); if (!$r) { showmessage(L('user_not_exist'), '?m=admin&c=index&a=login'); } if (isset($_GET['dosubmit'])) { pc_base::load_app_class('card', 'admin', 0); $result = card::verification($r['card'], $_POST['code'], $_POST['rand']); $_SESSION['card_verif'] = 1; header("location:?m=admin&c=index&a=login&dosubmit=1&card=1"); exit; } pc_base::load_app_class('card', 'admin', 0); $rand = card::authe_rand($r['card']); include $this->admin_tpl('login_card'); }
$_GET['rule'] = rawurldecode(trim($_GET['rule'])); $_GET['num'] = intval($_GET['num']); list($y, $m, $d) = explode("-", $_GET['cleardateline']); $_GET['step'] = $_GET['step'] ? $_GET['step'] : 1; $cleardateline = $_GET['cleardateline'] && $y && $m ? mktime(23, 59, 59, $m, $d, $y) : 0; if ($cleardateline < TIMESTAMP) { cpmsg('card_make_cleardateline_early', '', 'error'); } if (!$_GET['rule']) { cpmsg('card_make_rule_empty', '', 'error'); } if ($_GET['num'] < 1) { cpmsg('card_make_num_error', '', 'error'); } include libfile("class/card"); $card = new card(); $checkrule = $card->checkrule($_GET['rule'], 1); if ($checkrule === -2) { cpmsg('card_make_rule_error', '', 'error'); } if ($_GET['step'] == 1) { $card_rule = serialize(array('rule' => $_GET['rule'], 'price' => $_GET['price'], 'extcreditskey' => $_GET['extcreditskey'], 'extcreditsval' => $_GET['extcreditsval'], 'num' => $_GET['num'], 'cleardateline' => $cleardateline, 'typeid' => $_GET['typeid'])); $cardlog = array('uid' => $_G['uid'], 'username' => $_G['member']['username'], 'cardrule' => $card_rule, 'dateline' => $_G['timestamp'], 'description' => $_GET['description'], 'operation' => 1); $logid = C::t('common_card_log')->insert($cardlog, true); } $onepage_make = 500; $_GET['logid'] = $logid ? $logid : $_GET['logid']; if ($_GET['num'] > $onepage_make) { $step_num = ceil($_GET['num'] / $onepage_make); if ($step_num > 1) { if ($_GET['step'] == $step_num) {
// Todo // $g_fStartUtc = microtime(true); error_reporting(4095); require_once 'inc.cls.cardgame.php'; // config // define('S_NAME', '101_blackjack_v2_2008_02_05'); define('USE_DECKS', 6); define('CUT_CARD', 15); define('HIGHEST_HITTER', 16); define('DEFAULT_SCORE', 1000); // config // // session start after config, because session creation uses classes which use config constants session_start(); $bDebug = !empty($_SESSION[S_NAME]['debug']); card::$__tostring = function ($c) { return '<img src="/images/' . $c->suit . '_' . $c->short . '.gif" />'; }; if (!empty($_GET['reset']) || empty($_SESSION[S_NAME]['game'])) { $_SESSION[S_NAME]['game'] = null; $_SESSION[S_NAME]['game'] = new Blackjack(USE_DECKS); $_SESSION[S_NAME]['game']->dealer = new Dealer('Dealer'); $_SESSION[S_NAME]['game']->player = new Player('You'); $_SESSION[S_NAME]['game']->player->balance = DEFAULT_SCORE; if (!empty($_GET['reset'])) { header('Location: ' . basename($_SERVER['PHP_SELF'])); exit; } } else { if (isset($_GET['debug'])) { $_SESSION[S_NAME]['debug'] = !empty($_GET['debug']); header('Location: ' . basename($_SERVER['PHP_SELF']));
<pre><?php require_once 'inc.cls.cardgame.php'; require_once 'inc.cls.pokertexasholdem.php'; card::$__tostring = function ($c) { return '<img title="' . $c->id . '" src="images/' . $c->suit . '_' . $c->short . '.gif" />'; }; if (!isset($_GET['cards']) || count($arrCards = array_map('intval', explode(',', $_GET['cards']))) < 3) { $arrCards = array(1, 40, 25, 38, 14, 12, 31); } $arrCards = array_map(function ($c) { return new Card($c); }, $arrCards); echo implode(' ', array_map('strval', $arrCards)) . "\n\n"; $hand = pokertexasholdem::score($arrCards, $o); echo $hand . ' (' . pokertexasholdem::readable_hand($hand) . ")\n\n"; echo 'one pair ' . ($o->one_pair() ? 'Y' : 'N') . "\n"; echo 'two pair ' . ($o->two_pair() ? 'Y' : 'N') . "\n"; echo '3 of a kind ' . ($o->three_of_a_kind() ? 'Y' : 'N') . "\n"; echo 'straight ' . ($o->straight() ? 'Y' : 'N') . "\n"; echo 'flush ' . ($o->flush() ? 'Y' : 'N') . "\n"; echo 'full house ' . ($o->full_house() ? 'Y' : 'N') . "\n"; echo '4 of a kind ' . ($o->four_of_a_kind() ? 'Y' : 'N') . "\n"; echo "\n"; print_r($o);
$url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token={$token}&media_id={$mediaID}"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_NOBODY, 0); //只取body头 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $package = curl_exec($ch); $httpinfo = curl_getinfo($ch); curl_close($ch); $fileInfo = array_merge(array('header' => $httpinfo), array('body' => $package)); $this->saveWeixinFile($mediaID . ".amr", $fileInfo["body"], $mediaID); } function saveWeixinFile($filename, $filecontent, $mediaID) { $dir = dirname(__FILE__) . "/recordings/"; if (!is_dir($dir)) { mkdir($dir, 0777); } $local_file = fopen(dirname(__FILE__) . "/recordings/" . $filename, 'w'); if (false !== $local_file) { if (false !== fwrite($local_file, $filecontent)) { fclose($local_file); } } $this->to_mp3($mediaID); } } $show = new card(); $show->timer();
<?php require_once '../model/cardModel.php'; $card = new card(); $cardModel = new cardModel(); $prenom = $_POST['prenom']; $nom = $_POST['nom']; $cin = $_POST['cin']; $sexe = $_POST['sexe']; $date_naissance = $_POST['date_naissance_submit']; $adress = $_POST['adresse'] . ' ' . $_POST['zipcode'] . ' ' . $_POST['delegation'] . ' ' . $_POST['gouvernorat']; $yd_mail = $_POST['yd_mail']; $email = $_POST['email']; $statut = $_POST['statut']; $target_dir = "../view/images/Resources/photo/"; $target_file = $target_dir . basename($_FILES["file"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if (isset($_POST["submit"])) { $check = getimagesize($_FILES["file"]["tmp_name"]); if ($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) {
<?php require_once 'inc.cls.cardgame.php'; card::$__tostring = function ($c) { return '<img src="images/' . $c->suit . '.gif" /> ' . strtoupper($c->short); }; $objDeck = new Deck(); $objDeck->shuffle(); $iPlayers = 12; define('LOWEST_WORTHY_HAND', (int) @$_GET['min'] ?: 6); $arrPublic = $arrPlayers = array(); for ($i = 0; $i < $iPlayers; $i++) { $arrPlayers[$i] = array(); array_push($arrPlayers[$i], $objDeck->next()); array_push($arrPlayers[$i], $objDeck->next()); } while (5 > count($arrPublic)) { array_push($arrPublic, $objDeck->next()); } $fUtcStart = microtime(true); /* test * $arrPublic = array( new Card(8), new Card(0), new Card(3), new Card(7), new Card(6), ); $arrPlayers[0] = array( new Card(5), new Card(4),
$hand = $redHand; $redHand->showYourHand($id); echo $reloader; } echo "</div>"; echo '<div id="field">'; /********************************************************************************************************************** * Play a card (& display chosen one) **********************************************************************************************************************/ if (isset($_GET["card"]) && $_GET["card"] != 0) { if ($redplayer) { echo '<div id="chosencardred">'; } else { echo '<div id="chosencard">'; } $chosencard = new card($_GET["card"], false); $chosencard->displayyourcard($id); echo '</div>'; } $turn = getTurn($id); $yourturn = false; if ($turn % 2 == 0) { if (getRedPlayer($id) == getUserID($id)) { $yourturn = true; } } else { if (getBluePlayer($id) == getUserID($id)) { $yourturn = true; } } $field = new hand(getField($id), true);
session_start(); define('BASEPAGE', '/142'); define('S_NAME', 'mpp_142_v2'); define('TABLE_USERS', 'mpp_users'); define('TABLE_TABLES', 'mpp_tables'); define('TABLE_PLAYERS', 'mpp_players'); define('TABLE_BETS', 'mpp_bets'); define('TABLE_POOLS', 'mpp_pools'); define('MAX_PLAYERS_EVER', 10); require_once 'inc.db_mysql.php'; db_set(db_connect('localhost', 'usager', 'usager', 'games')); require_once 'inc.cls.json.php'; require_once 'inc.cls.cardgame.php'; require_once 'inc.cls.pokertexasholdem.php'; if (isset($_GET['card'])) { card::$__tostring = create_function('$c', 'return "images/".$c->suit."_".$c->short.".gif";'); $objCard = new Card($_GET['card']); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', 0) . ' GMT'); header('Content-type: image/gif'); readfile((string) $objCard); exit; } // Two stages for every user: logged in, not logged in // not logged in if (!logincheck()) { if (isset($_POST['username'], $_POST['password'])) { $szMessage = 'ERROR'; $arrUser = db_select(TABLE_USERS, "username = '******'username']) . "' AND password = '******'password']) . "'"); if (1 == count($arrUser)) { $arrSession = array('hash' => randString(20), 'ip' => ifsetor($_SERVER['REMOTE_ADDR'], ""), 'uid' => $arrUser[0]['id']); db_update(TABLE_USERS, 'hash = \'' . $arrSession['hash'] . "'", "id = '" . $arrSession['uid'] . "'");