Example #1
0
function doAll()
{
    for ($i = 0; $i < 4; $i++) {
        getPlayer($i);
        //get image from player and store in hands array
        getHand($i);
        //gets the cards and stores them in hands array
    }
    getWinner();
    //goes through the hands and chooses a winner
    drawGame();
    //prints all the hands including the winner
}
Example #2
0
function reportPlayer($id, $reason, $reporting_id)
{
    $con = QC_Database::getQuartzcoreDatabase();
    if (isset($id) && isset($reason)) {
        if ($player = getPlayer($id)) {
            if (mysqli_query($con, 'INSERT INTO Reports (reported_user_id, reporting_user_id, report_content) VALUES (' . $id . ', ' . $reporting_id . ', "' . $reason . '");')) {
                return array("reported" => true);
            } else {
                return array("reported" => false);
            }
        } else {
            return array("error" => "No player");
        }
    }
}
Example #3
0
if (empty($_GET['x'])) {
    $_GET['x'] = 'default';
}
if (in_Array($_GET['x'], $user_act) && $player->role >= 0) {
    if (!empty($_GET['set_pit'])) {
        $_GET['set_pit'] = (int) $_GET['set_pit'];
        $is = one("select pit_id from hellpit_pits where pit_id = " . $_GET['set_pit'] . " and pit_user = "******"update hellpit_users set actual_pit = " . $_GET['set_pit'] . " where user = "******"update hellpit_users set exp = exp - exp_lvl, exp_lvl = exp_lvl * 1.666, skills = skills + 3, lvl = lvl + 1 where user = " . $player->user);
        reload($_GET['x']);
    }
    $header = 'templates/user/header.php';
    $footer = 'templates/user/footer.php';
    $page = 'templates/user/' . $_GET['x'] . '.php';
} elseif (in_Array($_GET['x'], $master_act)) {
    $header = 'templates/master/header.php';
    $footer = 'templates/master/footer.php';
    $page = 'templates/master/' . $_GET['x'] . '.php';
} else {
    $header = 'templates/master/header.php';
    $footer = 'templates/master/footer.php';
Example #4
0
<?php

include_once 'htmlDefault.php';
include_once 'scoreFunctions.php';
$action = $_GET["action"];
if (!isset($action)) {
    print $html_string;
    exit;
}
define("ACTION_FAILED", -1);
define("UNKNOWN_ACTION", -2);
$connection = mysql_connect("localhost", "cookbook", "cookbook") or die(mysql_error());
mysql_select_db('cookbook_highscores');
switch ($action) {
    case 'get':
        getPlayer();
        break;
    case 'set':
        setPlayer();
        break;
    case 'xml':
        toXML();
        break;
    case 'html':
        toHTML();
        break;
    case 'reset':
        resetDatabase();
        break;
    default:
        print UNKNOWN_ACTION;
Example #5
0
function writeVideoPost($post)
{
    $player = getPlayer($post);
    $caption = getCaption($post);
    return $player . $caption;
}
<?php

$m = new MongoClient();
$db = $m->fantasy_football;
$players = $db->players;
$players->update(array('id' => 1), getPlayer());
$cursor = $players->find();
foreach ($cursor as $doc) {
    printOut($doc["web_name"]);
}
function getPlayer()
{
    printOut("getting player");
    return json_decode(file_get_contents("/var/www/html/fantasyFootball/MongoTest/player_1.json"), true);
}
function printOut($msg)
{
    echo "{$msg}\n";
}
Example #7
0
<?php

header('Content-Type: application/json');
require_once 'index.php';
require_once 'classes/player.php';
$value = array("error" => "Missing argument");
if (isset($_GET["action"])) {
    switch ($_GET["action"]) {
        case "getPlayer":
            if (isset($_GET["id"])) {
                //Get player by id
                $value = getPlayer($_GET["id"]);
                if ($value == false) {
                    $value = array("error" => "No player");
                }
            } else {
                $value = array("error" => "Missing argument");
            }
            break;
        case "getPlayerByName":
            if (isset($_GET["username"])) {
                //Get player by name
                $value = getPlayerByName($_GET['username']);
            } else {
                $value = array("error" => "Missing argument");
            }
            break;
        case "reportPlayer":
            if (isset($_GET["id"]) && isset($_GET["reporting_id"]) && isset($_GET["report"]) && isset($_GET['apikey'])) {
                if ($_GET['apikey'] == _API_KEY_) {
                    //Get player by id
Example #8
0
<?php

if (!empty($_POST['count']) && is_array($_POST['count'])) {
    foreach ($_POST['count'] as $key => $value) {
        $Pit = getClass('Pit');
        if ($value > 0) {
            $Pit->buy_crystal($player->user, $key, $value);
            $player = getPlayer($player->user);
        }
    }
}
if (!empty($_GET['sell']) && !empty($_POST['sell'])) {
    $Pit = getClass('Pit');
    $Pit->sell_demon($player, $_GET['sell'], $_POST['sell']);
    $player = getPlayer($player->user);
}
?>
			<!--  -->
			<h1>Piekielny Rynek</h1>
			<p>
				Zarządca Piekieł chętnie przekaże Ci magiczne kryształy służące do wabienia demonów do Twojej Otchłani. Każdy kryształ wymaga posiadania odpowiedniej ilości potępionych Dusz. <br/><br/>
				Możesz także przekazać mu przywołane demony, w zamian za co otrzymasz trochę Dusz i punktów doświadczenia.
			</p>

			
			<div class="box">
			
						
					  <strong>Kup kryształy</strong>
					 <form action='?x=hellmarket&act=buy' method='post'>
					 <dl class="list" style='width:640px;'>
Example #9
0
 function loadvod($row, $typearr, $flag)
 {
     global $cache, $mac;
     //if (!is_array($this->page_typearr)){ $this->page_typearr = getValueByArray($cache[0], "t_id", $mac["vodtypeid"]); }
     $this->page_typearr = $typearr;
     $mac["vodtypepid"] = $this->page_typearr["t_pid"];
     if ($flag == "view") {
         $cacheName = "vod_" . $mac["vodtypeid"];
         $cachetemplatename = "template_vod" . $mac["vodtypeid"];
         $templatepath = root . "template/" . app_templatedir . "/" . app_htmldir . "/" . $this->page_typearr["t_vodtemplate"];
     } else {
         if (app_playisopen == 1) {
             $playtemplatefile = "vodplayopen.html";
         } else {
             $playtemplatefile = $this->page_typearr["t_playtemplate"];
         }
         $cacheName = "vodplay_" . $mac["vodtypeid"];
         $cachetemplatename = "template_vodplay" . $mac["vodtypeid"];
         $templatepath = root . "template/" . app_templatedir . "/" . app_htmldir . "/" . $playtemplatefile;
     }
     if (chkCache($cacheName)) {
         $this->html = getCache($cacheName);
     } else {
         $this->html = getFileByCache($cachetemplatename, $templatepath);
         setCache($cacheName, $this->html, 0);
     }
     $slink = $this->getVodLink($row["d_id"], $row["d_name"], $row["d_enname"], $this->page_typearr["t_id"], $this->page_typearr["t_name"], $this->page_typearr["t_enname"]);
     $score = $row["d_score"];
     $scorecount = $row["d_scorecount"];
     if (!isNum($score)) {
         $score = 0;
     }
     if (!isNum($scorecount)) {
         $scorecount = 0;
     }
     $this->html = replaceStr($this->html, "[vodinfo:hits]", "<em id=\"hit\">加载中</em><script>getHit('vod','" . $row["d_id"] . "')</script>");
     $this->html = replaceStr($this->html, "[vodinfo:fav]", "<a href=\"javascript:void(0)\" onclick=\"sitefav('http://" . app_siteurl . $slink . "','" . $row["d_name"] . "在线看');return false;\"/>我要收藏</a>");
     $this->html = replaceStr($this->html, "[vodinfo:share]", "<a href=\"javascript:void(0)\" onclick=\"copyData(document.title +'   ' + window.location.href);return false;\"/>我要分享</a>");
     $this->html = replaceStr($this->html, "[vodinfo:error]", "<a href=\"javascript:void(0)\" onclick=\"vodError('" . $row["d_id"] . "','" . $row["d_name"] . "');return false;\"/>我要报错</a>");
     $this->html = replaceStr($this->html, "[vodinfo:scorenummark]", "<em id=\"score_num\"></em><script>getScore('','" . $row["d_id"] . "')</script>");
     $this->html = replaceStr($this->html, "[vodinfo:scorepjfmark]", "<em id=\"scorepjf_num\"></em><script>getScore('pjf','" . $row["d_id"] . "')</script>");
     $this->html = replaceStr($this->html, "[vodinfo:scorecountmark]", "<em id=\"scorecount_num\"></em><script>getScore('count','" . $row["d_id"] . "')</script>");
     $this->html = replaceStr($this->html, "[vodinfo:goodmark]", "<span id=\"good_num\"><script>getGoodBad('good','" . $row["d_id"] . "')</script></span><a href=\"javascript:void(0)\" onclick=\"vodGood(" . $row["d_id"] . ",'good_num');return false;\"/>顶一下</a>");
     $this->html = replaceStr($this->html, "[vodinfo:badmark]", "<span id=\"bad_num\"><script>getGoodBad('bad','" . $row["d_id"] . "')</script></span><a href=\"javascript:void(0)\" onclick=\"vodBad(" . $row["d_id"] . ",'bad_num');return false;\"/>踩一下</a>");
     $this->html = replaceStr($this->html, "[vodinfo:history]", "<script>history_New(window.location.href,'" . $row["d_name"] . "');</script>");
     $this->html = replaceStr($this->html, "[vodinfo:scoremark]", "<link rel=\"stylesheet\" href=\"" . app_installdir . "images/rater.css\" type=\"text/css\"  /><script src=\"" . app_installdir . "js/jquery.rater.js\"></script> <script>vodScoreMark(" . $row["d_id"] . "," . $scorecount . "," . $score . ");</script>");
     $this->html = replaceStr($this->html, "[vodinfo:scoremark1]", "<script>vodScoreMark1(" . $row["d_id"] . "," . $scorecount . "," . $score . ");</script>");
     if (indexOf($this->html, "[vodinfo:textlink]")) {
         $typeLink = $this->getVodTypeLink($this->page_typearr["t_id"], $this->page_typearr["t_name"], $this->page_typearr["t_enname"], true);
         $this->html = replaceStr($this->html, "[vodinfo:textlink]", $this->getTypeText($mac["vodtypeid"], $this->page_typearr["t_pid"], $this->page_typearr["t_name"], $typeLink, "vod") . "&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href='" . $slink . "'>" . $row["d_name"] . "</a>");
     }
     if (indexOf($this->html, "[vodinfo:prelink]")) {
         $this->html = replaceStr($this->html, "[vodinfo:prelink]", $this->getVodPreNextLink($row["d_id"], 0));
     }
     if (indexOf($this->html, "[vodinfo:nextlink]")) {
         $this->html = replaceStr($this->html, "[vodinfo:nextlink]", $this->getVodPreNextLink($row["d_id"], 1));
     }
     $this->replaceComment(1, $row["d_id"]);
     $this->replaceMood(1, $row["d_id"]);
     $this->replaceDigg(1, $row["d_id"]);
     $labelRule = buildregx("\\[vodinfo:\\s*([0-9a-zA-Z]+)([\\s]*[len|style]*)[=]??([\\da-zA-Z\\-\\\\/\\:\\s]*)\\]", "");
     preg_match_all($labelRule, $this->html, $matches2);
     for ($j = 0; $j < count($matches2[0]); $j++) {
         $marktemp = $this->parse("vod", $matches2[0][$j], $matches2[0][$j], $matches2[1][$j], $matches2[3][$j], $row, 0);
         $this->html = replaceStr($this->html, $matches2[0][$j], $marktemp);
     }
     unset($matches2);
     if ($flag == "play") {
         //            var_dump($mac["vodnum"]);
         if (app_vodplayviewtype < 3) {
             $this->html = replaceStr($this->html, "[playinfo:num]", $mac["vodnum"]);
             //            	$this->replacePlayNames($row["d_playfrom"],$row["d_playurl"],$mac["vodsrc"],$mac["vodnum"],$row["webUrls"]);
             $this->html = replaceStr($this->html, "[playinfo:name]", urldecode($mac['vodname']));
             $this->html = replaceStr($this->html, "[playinfo:info]", "<script>" . "\n" . getPlayInfos($row["d_name"], $row["d_playfrom"], $row["d_playserver"], $row["d_playurl"], $row["webUrls"]) . "\n" . " </script>" . "\n");
         } else {
             $playstr = getPlayInfo($row["d_name"], $row["d_playfrom"], $row["d_playserver"], $row["d_playurl"]);
             $playfile = "upload/playdata/" . $row["d_id"] . "/" . $row["d_id"] . ".js";
             $path = dirname("../" . $playfile);
             mkdirs($path);
             fwrite(fopen("../" . $playfile, "wb"), $playstr);
             $this->html = replaceStr($this->html, "[playinfo:info]", "<script src=\"" . app_installdir . $playfile . "\"></script>");
         }
         $this->html = replaceStr($this->html, "[playinfo:player]", getPlayer());
     }
     if (!($flag == "play" && app_vodplayviewtype > 3)) {
         $this->playlist($row["d_id"], $row["d_name"], $row["d_enname"], $row["d_type"], $this->page_typearr["t_name"], $this->page_typearr["t_enname"], $row["d_playfrom"], $row["d_playserver"], $row["d_playurl"], $row["webUrls"]);
     }
     $this->downlists($row["d_id"], $row["d_name"], $row["d_enname"], $row["d_type"], $this->page_typearr["t_name"], $this->page_typearr["t_enname"], $row["d_playfrom"], $row["d_playserver"], $row["d_playurl"], $row["webUrls"]);
     $rc = false;
     $starring = replaceStr($row["d_starring"], ",", " ");
     $arr1 = explode(" ", $starring);
     for ($i = 0; $i < count($arr1); $i++) {
         if (!isN($arr1[$i])) {
             if ($rc) {
                 $this->par_similar .= " or ";
             }
             $this->par_similar .= " d_starring like '%" . replaceStr($arr1[$i], "'", "''") . "%' ";
             $rc = true;
         }
     }
     unset($arr1);
     if ($rc) {
         $this->par_similar = " (" . $this->par_similar . ") ";
     }
     $this->mark();
     $this->ifEx();
     $this->run();
 }
Example #10
0
        $i = 0;
        foreach ($table->find('th') as $th) {
            if ($th->innertext == 'Player') {
                $index = $i;
            }
            $i++;
        }
        // loop through table rows - fetch player table cell
        $i = 0;
        foreach ($table->find('tr') as $tr) {
            // fetch index containing player data
            if (count($tr->find('td')) > 0 && isset($tr->find('td')[$index])) {
                $td = $tr->find('td')[$index];
                $player_url = $td->find('a', 0)->href;
                $player = $td->find('a', 0)->plaintext;
                if (getPlayer($player_url, $start, $end, $link)) {
                    addPlayer($player, $player_url, $start, $end, $slug, $link);
                    echo $player_url;
                    sleep(1);
                }
            }
            // if ($i == 2) exit;
            // echo $td->find('a', 0);
            // echo $td;
            // echo $player->plaintext;
            // if ($player->find('a')->href) echo $player->find('a')->href;
            $i++;
        }
    }
}
mysql_close($link);