当前位置: 首页>>代码示例>>PHP>>正文


PHP DBSiteInfo函数代码示例

本文整理汇总了PHP中DBSiteInfo函数的典型用法代码示例。如果您正苦于以下问题:PHP DBSiteInfo函数的具体用法?PHP DBSiteInfo怎么用?PHP DBSiteInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DBSiteInfo函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DBUserRunsYES

function DBUserRunsYES($contest, $site, $user)
{
    $b = DBSiteInfo($contest, $site);
    if ($b == null) {
        exit;
    }
    $t = $b["currenttime"];
    $c = DBConnect();
    $r = DBExec($c, "select distinct p.problemcolorname as colorname, p.problemcolor as color, " . "r.rundatediff as timestamp, p.problemnumber as number " . "from runtable as r, problemtable as p, answertable as a " . "where r.contestnumber={$contest} and p.contestnumber=r.contestnumber and " . "r.contestnumber=a.contestnumber and r.runproblem=p.problemnumber and " . "r.runsitenumber={$site} and r.usernumber={$user} and not r.runstatus ~ 'deleted' and " . "(r.rundatediffans<={$t} or (r.runstatus != 'judged' and r.rundatediff<={$t})) and " . "a.answernumber=r.runanswer and a.yes='t' order by r.rundatediff", "DBUserRunsYES(get run/prob/ans/lang)");
    $n = DBnlines($r);
    $a = array();
    $j = 0;
    $p = array();
    for ($i = 0; $i < $n; $i++) {
        $aa = DBRow($r, $i);
        if ($aa["timestamp"] < $b["sitelastmileanswer"]) {
            if (!isset($p[$aa["number"]])) {
                $p[$aa["number"]] = 1;
                $a[$j] = $aa;
                $j++;
            }
        }
    }
    return $a;
}
开发者ID:sbaldrich,项目名称:boca,代码行数:25,代码来源:frun.php

示例2: unset

            $i++;
        }
    } else {
        unset($strtmp);
    }
}
if ($doslow) {
    $run = DBUserRunsYES($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"], $_SESSION["usertable"]["usernumber"]);
    $n = count($run);
    for ($i = 0; $i < $n; $i++) {
        echo "<img alt=\"" . $run[$i]["colorname"] . "\" width=\"10\" " . "src=\"" . balloonurl($run[$i]["color"]) . "\" />\n";
    }
}
if (!isset($_SESSION["popuptime"]) || $_SESSION["popuptime"] < time() - 120) {
    $_SESSION["popuptime"] = time();
    if (($st = DBSiteInfo($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"])) != null) {
        $clar = DBUserClars($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"], $_SESSION["usertable"]["usernumber"]);
        for ($i = 0; $i < count($clar); $i++) {
            if ($clar[$i]["anstime"] > $_SESSION["usertable"]["userlastlogin"] - $st["sitestartdate"] && $clar[$i]["anstime"] < $st['siteduration'] && trim($clar[$i]["answer"]) != '' && !isset($_SESSION["popups"]['clar' . $i . '-' . $clar[$i]["anstime"]])) {
                $_SESSION["popups"]['clar' . $i . '-' . $clar[$i]["anstime"]] = "(Clar for problem " . $clar[$i]["problem"] . " answered)\n";
            }
        }
        $run = DBUserRuns($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"], $_SESSION["usertable"]["usernumber"]);
        for ($i = 0; $i < count($run); $i++) {
            if ($run[$i]["anstime"] > $_SESSION["usertable"]["userlastlogin"] - $st["sitestartdate"] && $run[$i]["anstime"] < $st['sitelastmileanswer'] && $run[$i]["ansfake"] != "t" && !isset($_SESSION["popups"]['run' . $i . '-' . $run[$i]["anstime"]])) {
                $_SESSION["popups"]['run' . $i . '-' . $run[$i]["anstime"]] = "(Run " . $run[$i]["number"] . " result: " . $run[$i]["answer"] . ')\\n';
            }
        }
    }
    $str = '';
    if (isset($_SESSION["popups"])) {
开发者ID:joffilyfe,项目名称:boca,代码行数:31,代码来源:header.php

示例3: DBLogInContest

function DBLogInContest($name, $pass, $contest, $msg = true)
{
    $b = DBGetRow("select * from contesttable where contestnumber={$contest}", 0, null, "DBLogIn(get active contest)");
    if ($b == null) {
        LOGLevel("There is no contest {$contest}.", 0);
        if ($msg) {
            MSGError("There is no contest {$contest}, contact an admin.");
        }
        return false;
    }
    $d = DBSiteInfo($b["contestnumber"], $b["contestlocalsite"], null, false);
    if ($d == null) {
        if ($msg) {
            MSGError("There is no active site, contact an admin.");
        }
        return false;
    }
    $a = DBGetRow("select * from usertable where username='{$name}' and contestnumber=" . $b["contestnumber"] . " and " . "usersitenumber=" . $b["contestlocalsite"], 0, null, "DBLogIn(get user)");
    if ($a == null) {
        if ($msg) {
            LOGLevel("User {$name} tried to log in contest {$contest} but it does not exist.", 2);
            MSGError("User does not exist or incorrect password.");
        }
        return false;
    }
    $a = DBUserInfo($b["contestnumber"], $b["contestlocalsite"], $a['usernumber'], null, false);
    $_SESSION['usertable'] = $a;
    $p = myhash($a["userpassword"] . session_id());
    $_SESSION['usertable']['userpassword'] = $p;
    if ($a["userpassword"] != "" && $p != $pass) {
        LOGLevel("User {$name} tried to log in contest {$contest} but password was incorrect.", 2);
        if ($msg) {
            MSGError("Incorrect password.");
        }
        unset($_SESSION["usertable"]);
        return false;
    }
    if ($d["sitepermitlogins"] == "f" && $a["usertype"] != "admin" && $a["usertype"] != "judge" && $a["usertype"] != "site") {
        LOGLevel("User {$name} tried to login contest {$contest} but logins are denied.", 2);
        if ($msg) {
            MSGError("Logins are not allowed.");
        }
        unset($_SESSION["usertable"]);
        return false;
    }
    if ($a["userenabled"] != "t") {
        LOGLevel("User {$name} tried to log in contest {$contest} but it is disabled.", 2);
        if ($msg) {
            MSGError("User disabled.");
        }
        unset($_SESSION["usertable"]);
        return false;
    }
    $gip = getIP();
    if ($a["userip"] != $gip && $a["userip"] != "" && $a["usertype"] != "score") {
        LOGLevel("User {$name} is using two different IPs: " . $a["userip"] . "(" . dateconv($a["userlastlogin"]) . ") and " . $gip, 1);
        if ($msg && $a["usertype"] != "admin") {
            MSGError("You are using two distinct IPs. Admin notified.");
        }
    }
    if ($a["userpermitip"] != "") {
        $ips = explode(';', $a["userpermitip"]);
        $gips = explode(';', $gip);
        if (count($gips) < count($ips)) {
            IntrusionNotify("Invalid IP: " . $gip);
            ForceLoad("index.php");
        }
        for ($ipss = 0; $ipss < count($ips); $ipss++) {
            $gipi = $gips[$ipss];
            $ipi = $ips[$ipss];
            if (!match_network($ipi, $gipi)) {
                IntrusionNotify("Invalid IP: " . $gip);
                ForceLoad("index.php");
            }
        }
    }
    $c = DBConnect();
    $t = time();
    if ($a["usertype"] == "team" && $a["usermultilogin"] != "t" && $a["userpermitip"] == "") {
        $r = DBExec($c, "update usertable set userip='" . $gip . "', updatetime=" . time() . ", userpermitip='" . $gip . "'," . "userlastlogin={$t}, usersession='" . session_id() . "' where username='{$name}' and contestnumber=" . $b["contestnumber"] . " and usersitenumber=" . $b["contestlocalsite"], "DBLogIn(update session)");
    } else {
        DBExec($c, "begin work");
        $sql = "update usertable set usersessionextra='" . session_id() . "' where username='{$name}' and contestnumber=" . $b["contestnumber"] . " and usersitenumber=" . $b["contestlocalsite"] . " and (usersessionextra='' or userip != '" . $gip . "' or userlastlogin<=" . ($t - 86400) . ")";
        DBExec($c, $sql);
        DBExec($c, "update usertable set userip='" . $gip . "', updatetime=" . time() . ", userlastlogin={$t}, " . "usersession='" . session_id() . "' where username='{$name}' and contestnumber=" . $b["contestnumber"] . " and usersitenumber=" . $b["contestlocalsite"], "DBLogIn(update user)");
        if ($name == 'admin') {
            list($clockstr, $clocktime) = siteclock();
            if ($clocktime < -600) {
                DBExec($c, "update contesttable set contestunlockkey='' where contestnumber=" . $b["contestnumber"], "DBLogInContest(update contest)");
            }
        }
        DBExec($c, "commit work");
    }
    LOGLevel("User {$name} authenticated (" . $gip . ")", 2);
    return $a;
}
开发者ID:justomiguel,项目名称:boca,代码行数:96,代码来源:flog.php

示例4: siteclock

function siteclock()
{
    if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"])) == null) {
        ForceLoad("../index.php");
    }
    ///////CASO DE COMECAR MAIS TARDE NO CENTRALIZADO
    if (substr($_SESSION["usertable"]["username"], 0, 3) == 'XXX') {
        $s["currenttime"] = $s["currenttime"] - 60 * 10;
        // 10 minutos
    }
    if ($s["siteactive"] != "t") {
        return array("site is not active", -1000000000);
    }
    if (!$s["siterunning"]) {
        return array("contest not running", -1000000000);
    }
    if ($s["currenttime"] < 0) {
        $t = -$s["currenttime"];
        if ($t > 3600) {
            $t = (int) ($t / 360) / 10;
            return array("&gt; " . $t . " hour(s) to start", $s["currenttime"]);
        }
        if ($t > 60) {
            $t = (int) ($t / 60);
            return array("&gt; " . $t . " min(s) to start", $s["currenttime"]);
        } else {
            return array($t . " second(s) to start", $s["currenttime"]);
        }
    }
    if ($s["currenttime"] >= 0) {
        $t = $s["siteduration"] - $s["currenttime"];
        $str = '';
        if ($t >= 3600) {
            $str .= (int) ($t / 3600) . 'h ';
            $t = $t % 3600;
        }
        if ($t > 60) {
            $t = (int) ($t / 60);
            return array($str . $t . " min(s) left", $s["currenttime"]);
        } else {
            if ($str == '') {
                if ($t > 0) {
                    return array($t . " second(s) left", $s["currenttime"]);
                } else {
                    $t = (int) (-$t / 60);
                    return array($t . "min. of extra time", $s["currenttime"]);
                }
            } else {
                return array($str . " left", $s["currenttime"]);
            }
        }
    } else {
        return array("not started", -1000000000);
    }
}
开发者ID:sbaldrich,项目名称:boca,代码行数:55,代码来源:fcontest.php

示例5: header

<?php

require '../../db.php';
require '../config.php';
header('Content-type: text/plain; encoding=utf-8');
$s = DBSiteInfo($contest, $site);
$run = DBAllRunsInSites($contest, $site, 'run');
$numRuns = count($run);
for ($i = 0; $i < $numRuns; $i++) {
    $u = DBUserInfo($contest, $site, $run[$i]['user']);
    $runID = $run[$i]['number'];
    $runTime = dateconvminutes($run[$i]['timestamp']);
    $runTeam = $u['username'];
    $runProblem = $run[$i]['problem'];
    if ($runTime > $freezeTime) {
        continue;
    }
    echo $runID . '' . $runTime . '' . $runTeam . '' . $runProblem . '';
    if ($run[$i]['yes'] == 't') {
        echo 'Y' . "\n";
    } else {
        if ($run[$i]['answer'] == 'Not answered yet') {
            echo '?' . "\n";
        } else {
            echo 'N' . "\n";
        }
    }
}
开发者ID:sbaldrich,项目名称:boca,代码行数:28,代码来源:index.php

示例6: DBNewClar

function DBNewClar($param, $c = null)
{
    if (isset($param['contestnumber']) && !isset($param['contest'])) {
        $param['contest'] = $param['contestnumber'];
    }
    if (isset($param['sitenumber']) && !isset($param['site'])) {
        $param['site'] = $param['sitenumber'];
    }
    if (isset($param['usernumber']) && !isset($param['user'])) {
        $param['user'] = $param['usernumber'];
    }
    if (isset($param['number']) && !isset($param['clarnumber'])) {
        $param['clarnumber'] = $param['number'];
    }
    $ac = array('contest', 'site', 'user', 'problem', 'question');
    $ac1 = array('clarnumber', 'clardate', 'clardatediff', 'clardatediffans', 'claranswer', 'clarstatus', 'clarjudge', 'clarjudgesite', 'updatetime');
    $type['contest'] = 1;
    $type['problem'] = 1;
    $type['updatetime'] = 1;
    $type['site'] = 1;
    $type['user'] = 1;
    $type['clarnumber'] = 1;
    $type['clardatediffans'] = 1;
    $type['clardatediff'] = 1;
    $type['clardate'] = 1;
    $type['clarjudge'] = 1;
    $type['clarjudgesite'] = 1;
    foreach ($ac as $key) {
        if (!isset($param[$key]) || $param[$key] == "") {
            MSGError("DBNewClar param error: {$key} not found");
            return false;
        }
        if (isset($type[$key]) && !is_numeric($param[$key])) {
            MSGError("DBNewClar param error: {$key} is not numeric");
            return false;
        }
        ${$key} = sanitizeText($param[$key]);
    }
    $t = time();
    $clarnumber = -1;
    $updatetime = -1;
    $clardatediff = -1;
    $clardate = $t;
    $claranswer = '';
    $clardatediffans = 999999999;
    $clarjudge = 'NULL';
    $clarjudgesite = 'NULL';
    $clarstatus = 'openclar';
    foreach ($ac1 as $key) {
        if (isset($param[$key])) {
            ${$key} = sanitizeText($param[$key]);
            if (isset($type[$key]) && !is_numeric($param[$key])) {
                MSGError("DBNewClar param error: {$key} is not numeric");
                return false;
            }
        }
    }
    if ($updatetime < 0) {
        $updatetime = $t;
    }
    $cw = false;
    if ($c == null) {
        $cw = true;
        $c = DBConnect();
        DBExec($c, "begin work", "DBNewClar(transaction)");
    }
    $insert = true;
    if ($clarnumber < 0) {
        $sql = "select sitenextclar as nextclar from sitetable where sitenumber={$site} and contestnumber={$contest} for update";
        $r = DBExec($c, $sql, "DBNewClar(get site for update)");
        if (DBnlines($r) != 1) {
            DBExec($c, "rollback work", "DBNewClar(rollback-site)");
            LOGError("Unable to find a unique site/contest in the database. SQL=(" . $sql . ")");
            MSGError("Unable to find a unique site/contest in the database. Contact an admin now!");
            exit;
        }
        $a = DBRow($r, 0);
        $n = $a["nextclar"] + 1;
        $clarnumber = $n;
    } else {
        $sql = "select * from clartable as t where t.contestnumber={$contest} and " . "t.clarsitenumber={$site} and t.clarnumber={$clarnumber}";
        $r = DBExec($c, $sql . " for update", "DBNewClar(get clar for update)");
        $n = DBnlines($r);
        if ($n > 0) {
            $insert = false;
            $lr = DBRow($r, 0);
            $t = $lr['updatetime'];
        }
        $n = $clarnumber;
    }
    DBExec($c, "update sitetable set sitenextclar={$clarnumber}, updatetime=" . $t . " where sitenumber={$site} and contestnumber={$contest} and sitenextclar<{$clarnumber}", "DBNewClar(update site)");
    if ($clardatediff < 0) {
        $b = DBSiteInfo($contest, $site, $c);
        $dif = $b["currenttime"];
        $clardatediff = $dif;
        if ($dif < 0) {
            DBExec($c, "rollback work", "DBNewClar(rollback-started)");
            LOGError("Tried to submit a clarification but the contest is not started. SQL=(" . $sql . ")");
            MSGError("The contest is not started yet!");
            return false;
//.........这里部分代码省略.........
开发者ID:sbaldrich,项目名称:boca,代码行数:101,代码来源:fclar.php

示例7: header

 if ($_POST["confirmation"] == "confirm" && isset($_POST['localsite']) && is_numeric($_POST['localsite']) && isset($_POST['challenge']) && isset($_POST['password'])) {
     $localsite = $_POST['localsite'];
     header("Content-transfer-encoding: binary\n");
     header("Content-type: application/force-download");
     //header ("Content-type: application/octet-stream");
     //if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))
     //	header("Content-Disposition: filename=" .$_GET["filename"]); // For IE
     //else
     header("Content-Disposition: attachment; filename=export.dat");
     ob_end_flush();
     $reduced = false;
     if (isset($_POST["Submit"]) && $_POST['Submit'] == "Reduced Export") {
         $reduced = true;
     }
     $fromsite = $localsite;
     $siteinfo = DBSiteInfo($_SESSION["usertable"]["contestnumber"], $fromsite);
     $scores = explode(",", $siteinfo['siteglobalscore']);
     if (count($scores) == 0 || count($scores) == 1 && !is_numeric($scores[0])) {
         $scores = array($fromsite);
     }
     $judges = explode(",", $siteinfo['sitejudging']);
     if (count($judges) == 0 || count($judges) == 1 && !is_numeric($judges[0])) {
         $judges = array($fromsite);
     }
     $scores = array_unique(array_merge($scores, $judges));
     if (in_array(0, $scores)) {
         $scores = null;
     }
     $xml = generateXML($_SESSION["usertable"]["contestnumber"], $localsite, $scores, $reduced);
     if (isset($_POST['nopassword']) && $_POST['nopassword'] == 'true') {
         echo $xml;
开发者ID:sbaldrich,项目名称:boca,代码行数:31,代码来源:export.php

示例8: DBUserTasks

function DBUserTasks($contest, $site, $user)
{
    $b = DBSiteInfo($contest, $site);
    if ($b == null) {
        exit;
    }
    $t = $b["currenttime"];
    $c = DBConnect();
    $r = DBExec($c, "select distinct t.sitenumber as site, t.tasknumber as number, " . "t.taskdatediff as timestamp, t.taskstatus as status, t.taskfilename as filename, " . "t.taskdesc as description, t.updatetime " . "from tasktable as t " . "where t.contestnumber={$contest} and t.sitenumber={$site} and " . "(t.taskdatediffans<={$t} or (t.taskstatus != 'done' and t.taskdatediff<={$t})) and " . "t.usernumber={$user} and t.taskstatus != 'deleted' and t.tasksystem='f' " . "order by t.updatetime", "DBUserTasks(get tasks)");
    $n = DBnlines($r);
    $a = array();
    for ($i = 0; $i < $n; $i++) {
        $a[$i] = DBRow($r, $i);
    }
    return $a;
}
开发者ID:sbaldrich,项目名称:boca,代码行数:16,代码来源:ftask.php

示例9: InvalidSession

//$loc = $_SESSION['loc'];
$loc = $locr = "../..";
require_once $locr . "/globals.php";
if (!ValidSession()) {
    InvalidSession($_SERVER['PHP_SELF']);
    ForceLoad($loc . "/index.php");
}
if ($_SESSION["usertable"]["usertype"] != "admin") {
    IntrusionNotify($_SERVER['PHP_SELF']);
    ForceLoad($loc . "/index.php");
}
require_once $locr . "/db.php";
require_once $locr . "/freport.php";
echo "<html><head><title>Report Page</title>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
echo "<link rel=stylesheet href=\"{$loc}/Css.php\" type=\"text/css\">\n";
$contest = $_SESSION["usertable"]["contestnumber"];
if (($ct = DBContestInfo($contest)) == null) {
    ForceLoad($loc . "/index.php");
}
$site = $_SESSION["usertable"]["usersitenumber"];
if (($st = DBSiteInfo($contest, $site)) == null) {
    ForceLoad($loc . "/index.php");
}
echo "</head><body><table border=1 width=\"100%\">\n";
echo "<tr><td bgcolor=\"eeee00\" nowrap align=center>";
echo "<img src=\"{$loc}/images/smallballoontransp.png\" alt=\"\">";
echo "<font color=\"#ffffff\"><a href=\"http://www.ime.usp.br/~cassio/boca/\">BOCA</a></font>";
echo "</td><td bgcolor=\"#eeee00\" width=\"99%\">\n";
echo $ct["contestname"] . " - " . $st["sitename"] . "</td>\n";
echo "</tr></table>\n";
开发者ID:guirighetto,项目名称:BOCA_PROTEUM,代码行数:31,代码来源:header.php

示例10: DBGetAllProblems

function DBGetAllProblems($contest)
{
    if (($b = DBSiteInfo($contest, $_SESSION["usertable"]["usersitenumber"])) == null) {
        return array();
    }
    $c = DBConnect();
    $sql = "select distinct p.problemnumber as number, p.problemname as problem, " . "p.problemcolor as color, p.problemcolorname as colorname " . "from problemtable as p " . "where p.contestnumber={$contest} and p.problemfullname !~ '(DEL)' ";
    if ($b["currenttime"] < 0) {
        $sql .= "and p.fake='t' ";
    }
    $sql .= " order by p.problemnumber";
    $r = DBExec($c, $sql, "DBGetAllProblems(get problems)");
    $n = DBnlines($r);
    $a = array();
    for ($i = 0; $i < $n; $i++) {
        $a[$i] = DBRow($r, $i);
    }
    return $a;
}
开发者ID:sbaldrich,项目名称:boca,代码行数:19,代码来源:fproblem.php

示例11: DBUpdateSite

            $param['siteautoend'] = $_POST["autoend"];
        }
        if (isset($_POST["globalscore"])) {
            $param['siteglobalscore'] = $_POST["globalscore"];
        }
        if (isset($_POST["active"])) {
            $param['siteactive'] = $_POST["active"];
        }
        $param['sitescorelevel'] = $_POST["scorelevel"];
        $param['sitepermitlogins'] = '';
        if (isset($_POST["autojudge"])) {
            $param['siteautojudge'] = $_POST["autojudge"];
        }
        $param['sitechiefname'] = $_POST["chiefname"];
        DBUpdateSite($param);
        $st1 = DBSiteInfo($_SESSION["usertable"]["contestnumber"], $_POST["site"]);
        if ($t != $st1["sitestartdate"]) {
            $param = array('contest' => $_SESSION["usertable"]["contestnumber"], 'site' => $_POST["site"], 'start' => $t);
            DBRenewSiteTime($param);
        }
    }
    ForceLoad("site.php?site=" . $_POST["site"]);
}
if ($main && isset($_FILES["importfile"]) && isset($_POST["Submit"]) && $_POST["Submit"] == 'Import' && $_FILES["importfile"]["name"] != "") {
    if ($_POST["confirmation"] == "confirm") {
        $type = myhtmlspecialchars($_FILES["importfile"]["type"]);
        $size = myhtmlspecialchars($_FILES["importfile"]["size"]);
        $name = myhtmlspecialchars($_FILES["importfile"]["name"]);
        $temp = myhtmlspecialchars($_FILES["importfile"]["tmp_name"]);
        if (!is_uploaded_file($temp)) {
            IntrusionNotify("file upload problem.");
开发者ID:sbaldrich,项目名称:boca,代码行数:31,代码来源:site.php

示例12: DBScore

        $teamUni = $teamName;
    }
    $contestfile = $contestfile . $teamID . '' . $teamUni . '' . $teamName . "\n";
}
$contestfile = $contestfile . '1' . '' . '1' . "\n";
$contestfile = $contestfile . $numProblems . '' . 'Y' . "\n";
$score = DBScore($_SESSION["usertable"]["contestnumber"], false, -1, $ct["contestlocalsite"]);
//$contestfile = $contestfile .
//	"<h2>ICPC Output</h2>";
//$contestfile = $contestfile .
//	"<pre>";
$n = 0;
$class = 1;
while (list($e, $c) = each($score)) {
    if (isset($score[$e]["site"]) && isset($score[$e]["user"])) {
        if (DBSiteInfo($_SESSION["usertable"]["contestnumber"], $score[$e]["site"]) != null) {
            $r = DBUserInfo($_SESSION["usertable"]["contestnumber"], $score[$e]["site"], $score[$e]["user"]);
            $contestfile = $contestfile . $r["usericpcid"] . "," . $class++ . "," . $score[$e]["totalcount"] . "," . $score[$e]["totaltime"] . ",";
            if ($score[$e]["first"]) {
                $contestfile = $contestfile . $score[$e]["first"] . "\n";
            } else {
                $contestfile = $contestfile . "0\n";
            }
            $n++;
        }
    }
}
//$contestfile = $contestfile .
//	"</pre>";
$timefile = $st['currenttime'];
$versionfile = '1.0' . "\n";
开发者ID:sbaldrich,项目名称:boca,代码行数:31,代码来源:webcast.php

示例13: DBScoreSite

function DBScoreSite($contest, $site, $verifylastmile, $hor = -1, $data = null)
{
    if (($blocal = DBSiteInfo($contest, $_SESSION["usertable"]["usersitenumber"])) == null) {
        exit;
    }
    if (($b = DBSiteInfo($contest, $site, null, false)) == null) {
        $b = $blocal;
    }
    if (($ct = DBContestInfo($contest)) == null) {
        exit;
    }
    $t = time();
    $ta = $blocal["currenttime"];
    if ($hor >= 0) {
        $ta = $hor;
    }
    if ($verifylastmile) {
        $tf = $b["sitelastmilescore"];
    } else {
        $tf = $b["siteduration"];
    }
    if ($data != null && is_numeric($data)) {
        if ($data < $ta) {
            $ta = $data;
        }
        $data = null;
    }
    $data0 = array();
    if ($data == null) {
        $c = DBConnect();
        $resp = array();
        $r = DBExec($c, "select * from usertable where contestnumber={$contest} and usersitenumber={$site} and " . "usertype='team' and userlastlogin is not null and userenabled='t'", "DBScoreSite(get users)");
        $n = DBnlines($r);
        for ($i = 0; $i < $n; $i++) {
            $a = DBRow($r, $i);
            $resp[$a["usernumber"]]["user"] = $a["usernumber"];
            $resp[$a["usernumber"]]["site"] = $a["usersitenumber"];
            $resp[$a["usernumber"]]["username"] = $a["username"];
            $resp[$a["usernumber"]]["usertype"] = $a["usertype"];
            $resp[$a["usernumber"]]["userfullname"] = $a["userfullname"];
            $resp[$a["usernumber"]]["totaltime"] = 0;
            $resp[$a["usernumber"]]["totalcount"] = 0;
            $resp[$a["usernumber"]]["problem"] = array();
        }
        $r = DBExec($c, "select r.usernumber as user, p.problemname as problemname, r.runproblem as problem, " . "p.problemcolor as color, p.problemcolorname as colorname, " . "r.rundatediff as time, r.rundatediffans as anstime, a.yes as yes, r.runanswer as answer from " . "runtable as r, answertable as a, problemtable as p where r.runanswer=a.answernumber and " . "a.contestnumber={$contest} and p.problemnumber=r.runproblem and p.contestnumber={$contest} and " . "r.contestnumber={$contest} and r.runsitenumber={$site} and (r.runstatus ~ 'judged' or r.runstatus ~ 'judged+') and " . "r.rundatediff>=0 and r.rundatediff<={$tf} and r.rundatediffans<={$ta} " . "order by r.usernumber, r.runproblem, r.rundatediff", "DBScoreSite(get runs)");
        $n = DBnlines($r);
        $a = array();
        for ($i = 0; $i < $n; $i++) {
            $a[$i] = DBRow($r, $i);
        }
        $data0['n'] = $n;
        $data0['resp'] = $resp;
        $data0['a'] = $a;
        $data0['site'] = $site;
    } else {
        $resp = $data['resp'];
        $n = $data['n'];
        $a = $data['a'];
    }
    $i = 0;
    while ($i < $n) {
        if ($a[$i]["anstime"] > $ta) {
            $i++;
            continue;
        }
        $user = $a[$i]["user"];
        $problem = $a[$i]["problem"];
        $time = 0;
        $k = 0;
        if (!isset($resp[$user])) {
            $i++;
            continue;
        }
        $resp[$user]["user"] = $user;
        $resp[$user]["site"] = $site;
        $resp[$user]["problem"][$problem]["name"] = $a[$i]["problemname"];
        $resp[$user]["problem"][$problem]["color"] = $a[$i]["color"];
        $resp[$user]["problem"][$problem]["colorname"] = $a[$i]["colorname"];
        $resp[$user]["problem"][$problem]["solved"] = false;
        $resp[$user]["problem"][$problem]["judging"] = false;
        $resp[$user]["problem"][$problem]["time"] = 0;
        $resp[$user]["problem"][$problem]["penalty"] = 0;
        $resp[$user]["problem"][$problem]["count"] = 0;
        while ($i < $n && $a[$i]["anstime"] <= $ta && $a[$i]["user"] == $user && $a[$i]["problem"] == $problem && $a[$i]["yes"] != 't') {
            $time += (int) ($ct["contestpenalty"] / 60);
            $k++;
            $i++;
        }
        $resp[$user]["problem"][$problem]["count"] = $k;
        if ($i >= $n) {
            break;
        }
        if ($a[$i]["anstime"] <= $ta && $a[$i]["user"] == $user && $a[$i]["problem"] == $problem && $a[$i]["yes"] == 't') {
            $timet = (int) ($a[$i]["time"] / 60);
            if (!isset($resp[$user]["first"]) || $timet < $resp[$user]["first"]) {
                $resp[$user]["first"] = $timet;
            }
            $time += $timet;
            $resp[$user]["problem"][$problem]["time"] = $timet;
            $resp[$user]["problem"][$problem]["penalty"] = $time;
//.........这里部分代码省略.........
开发者ID:sbaldrich,项目名称:boca,代码行数:101,代码来源:fscore.php


注:本文中的DBSiteInfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。