コード例 #1
0
         if ($t['player' . $i] == 0 && $field == '') {
             $field = 'player' . $i;
         }
     }
     mysql_query("UPDATE tournaments set " . $field . " = '" . $_SESSION['playerID'] . "' WHERE id = '{$id}'");
     // That was the easy part, now create the games
     if ($field == 'player4') {
         create_games($id);
     }
 } elseif ($t['players'] == 16) {
     // Evil BIG tournament from hell
     // Okay, lets get the 4 Group Games
     $game2join = '';
     $b = mysql_query("SELECT * FROM tournaments WHERE big='{$id}' AND name NOT like '%Finals' ORDER BY id ASC");
     while ($big = mysql_fetch_array($b)) {
         if (get_num($big['id']) < $big['players'] && $game2join == '') {
             $game2join = $big;
             $game2join['gamenum'] = $i;
         }
     }
     // while
     if ($game2join == '') {
         echo "<b>Tournament full</b>";
         exit;
     }
     // Now we got the game 2 join, yeah, now it's gettin' way easier
     $field = '';
     for ($i = 1; $i < 5; $i++) {
         if ($game2join['player' . $i] == 0 && $field == '') {
             $field = 'player' . $i;
         }
コード例 #2
0
ファイル: hl.php プロジェクト: pkgw/hera-librarian
function edit_store_action()
{
    $store = new StdClass();
    $store->name = get_str("name");
    $store->capacity = get_num("capacity") * GIGA;
    $store->used = get_num("used") * GIGA;
    $store->rsync_prefix = get_str("rsync_prefix");
    $store->http_prefix = get_str("http_prefix");
    $store->path_prefix = get_str("path_prefix");
    $store->ssh_prefix = get_str("ssh_prefix");
    $store->unavailable = get_str("unavailable", true) ? true : false;
    $id = get_num("id");
    if ($id) {
        $ret = store_update_all($id, $store);
    } else {
        $store->create_time = time();
        $ret = store_insert($store);
    }
    if (!$ret) {
        error_page("database error");
    }
    redirect("hl.php?action=stores");
}
コード例 #3
0
ファイル: lognsign.php プロジェクト: zhm9484/website
    $formerUrl = $referer . '&';
} else {
    $formerUrl = split('\\?', $referer)[0] . '?';
}
if (isset($_POST["submit"]) && $_POST["submit"] == "SignUp") {
    include "db_connect.php";
    $pdo_connect = pdo_connect();
    $pdo_connect->beginTransaction();
    $username = $_POST["username"];
    $password = $_POST["password"];
    if (get_num("username", $username, $pdo_connect, "user_login") != 0) {
        header('Location: ' . $formerUrl . 'resignup=1');
    } else {
        $sql = "INSERT INTO user_login(username, password) VALUES('{$username}', '{$password}')";
        $pdo_connect->query($sql);
        get_num("username", $username, $pdo_connect, "user_login");
        $openid = create_openid(44);
        $sql = "SELECT * FROM user_login WHERE openid='{$openid}'";
        $result = $pdo_connect->query($sql);
        while ($result->rowCount() != 0) {
            $openid = create_function(44);
            $sql = "SELECT * FROM user_login WHERE openid='{$openid}'";
            $result = $pdo_connect->query($sql);
        }
        $sql = "UPDATE user_login SET openid='{$openid}' WHERE username='******'";
        $pdo_connect->query($sql);
        $pdo_connect->commit();
        setcookie("openid", $openid, time() + 60 * 60 * 24 * 7, "/manye");
        setcookie("username", $username, time() + 60 * 60 * 24 * 7, "/manye");
        header('Location: ' . $formerUrl . '');
    }
コード例 #4
0
function started($id) {

$t = mysql_query("SELECT * FROM tournaments WHERE id = '$id'");
$t = mysql_fetch_array($t);

$num = get_num($id);

if ($num == $t['players'])
{
    $started = true;
}
else
{
    $started = false;
}

return $started;

}
コード例 #5
0
ファイル: stat.php プロジェクト: rogeriopradoj/browser-update
    } elseif (!$fromn) {
        $q = sprintf("SELECT COUNT(*) FROM updates WHERE ton='{$ton}'");
    } elseif (!$ton) {
        $q = sprintf("SELECT COUNT(*) FROM updates WHERE fromn='{$fromn}'");
    } else {
        $q = sprintf("SELECT COUNT(*) FROM updates WHERE fromn='{$fromn}' AND ton='{$ton}'");
    }
    $r = mysql_query($q) or die(mysql_error() . $q);
    list($num) = mysql_fetch_row($r);
    return $num;
}
$names = array("i" => 'Internet Explorer', "f" => 'Firefox', "o" => 'Opera', "s" => 'Apple Safari', "n" => 'Netscape Navigator', "c" => 'Google Chrome', "" => '?');
?>
<p>
    <?php 
$visitors_upgraded = get_num();
echo sprintf(T_('<strong class="number">%d</strong> visitors have already upgraded their browser.'), $visitors_upgraded);
?>
</p>
<?php 
/*
<ul class="statleft">
	<li>to FF: <?php echo get_num(false,'f')?></li>
	<li>to Opera: <?php echo get_num(false,'o')?></li>
	<li>to Safari: <?php echo get_num(false,'s')?></li>
	<li>to IE: <?php echo get_num(false,'i')?></li>
</ul>

<ul>
	<li>from FF: <?php echo get_num('f',false)?></li>
	<li>from Opera: <?php echo get_num('o',false)?></li>