die; } $aColumns = array('username', 'runid', 'pid', 'result', 'language', 'time_used', 'memory_used', 'length(source)', "time_submit", "isshared"); $sIndexColumn = "runid"; $sTable = "status"; //paging $sLimit = ""; if (isset($_GET['iDisplayStart']) && $_GET['iDisplayLength'] != '-1') { $sLimit = "LIMIT " . convert_str($_GET['iDisplayStart']) . ", " . convert_str($_GET['iDisplayLength']); } foreach ((array) contest_get_problem_basic($cid) as $row) { $ltop[$row["lable"]] = $row["pid"]; $ptocp[$row["pid"]] = $row["cpid"]; $ptol[$row["pid"]] = $row["lable"]; } $ishide = contest_get_val($cid, "hide_others"); if ($current_user->is_root()) { $isroot = true; } else { $isroot = false; } if ($ishide && $isroot) { $ishide = false; } if (contest_passed($cid)) { $hidedt = false; } else { $hidedt = true; } $sOrder = "ORDER BY runid desc"; /* Individual column filtering */
<?php include_once dirname(__FILE__) . "/../functions/users.php"; include_once dirname(__FILE__) . "/../functions/contests.php"; include_once dirname(__FILE__) . "/../functions/runs.php"; $runid = convert_str($_GET['runid']); $cid = run_get_val($runid, "contest_belong"); $uname = run_get_val($runid, "username"); $ret["code"] = 1; if (!($cid == "0" || contest_get_val($cid, "hide_others") == 0 || contest_passed($cid) || $current_user->match($uname) || $current_user->is_root())) { $ret["msg"] = "Permission denined."; } else { $query = "select runid,result,memory_used,time_used from status where runid='{$runid}'"; $ret = $db->get_row($query, ARRAY_A); $ret["code"] = 0; } echo json_encode($ret);
$ret["msg"] = "Please login as root!"; die(json_encode($ret)); } $runid = convert_str($_GET['runid']); if ($runid == "") { $ret["msg"] = "Invalid request."; die(json_encode($ret)); } $sql = "select pid,result,contest_belong from status where runid='{$runid}'"; list($pid, $result, $cid) = $db->get_row($sql, ARRAY_N); if ($pid == "") { $ret["msg"] = "Invalid runid."; die(json_encode($ret)); } $ispretest = true; if ($cid == "0" || contest_get_val($cid, "has_cha") == 0 || contest_passed($cid)) { $ispretest = false; } $host = $config["contact"]["server"]; $port = $config["contact"]["port"]; list($vname) = $db->get_row("select vname from problem where pid='{$pid}'", ARRAY_N); $sql_r = "update status set result='Rejudging' where runid='{$runid}' "; $db->query($sql_r); $host = $config["contact"]["server"]; $port = $config["contact"]["port"]; $fp = @fsockopen($host, $port, $errno, $errstr); if (!$fp) { $ret["msg"] = "Socket open error!"; echo json_encode($ret); die; } else {
function contest_get_comparable_list($cid) { global $db, $contest_infos; if (!isset($contest_infos[$cid])) { load_contest_infos($cid); } if (!$contest_infos[$cid]["valid"]) { return false; } if (isset($contest_infos[$cid]["comparable_list"])) { return $contest_infos[$cid]["comparable_list"]; } $allp = $db->escape(contest_get_val($cid, "allp")); if (!contest_started($cid)) { $csql = "select cid from contest where cid = '{$cid}'"; } else { $csql = "select cid from contest where allp = '{$allp}' and start_time < NOW() order by start_time desc"; } foreach ((array) $db->get_results($csql, ARRAY_A) as $value) { $contest_infos[$cid]["comparable_list"][] = $value["cid"]; } return $contest_infos[$cid]["comparable_list"]; }
<?php include_once 'functions/users.php'; include_once 'functions/sidebars.php'; include_once 'functions/contests.php'; $cid = convert_str($_GET["cid"]); if (!contest_started($cid) || !($current_user->is_root() || contest_get_val($cid, "isprivate") == 0 || contest_get_val($cid, "isprivate") == 1 && $current_user->is_in_contest($cid) || contest_get_val($cid, "isprivate") == 2 && contest_get_val($cid, "password") == $_COOKIE[$config["cookie_prefix"] . "contest_pass_{$cid}"])) { ?> <div class="span12"> <p class="alert alert-error">Contest not started or you're not in this contest.</p> </div> <?php } else { ?> <div class="span9"> <h1 class="pagetitle" style="display:none">Clarifications For Contest <?php echo $cid; ?> </h1> <?php if ($current_user->is_root()) { $res = contest_get_all_clarify($cid); } else { $res = contest_get_visible_clarify($cid, convert_str($current_user->get_username())); } foreach ((array) $res as $row) { ?> <h4><?php echo $row["ispublic"] == '0' ? "Private Message" : "Public Message"; ?> </h4>
<?php include_once dirname(__FILE__) . "/../functions/contests.php"; include_once dirname(__FILE__) . "/../functions/problems.php"; include_once dirname(__FILE__) . "/../functions/users.php"; $ret = array(); $ret["code"] = 1; $cid = convert_str($_POST['cid']); if ($current_user->is_root() && contest_get_val($cid, "type") != 99) { $title = htmlspecialchars(convert_str($_POST['title'])); /*$sql_cn = "select max(cid) from contest"; $que_cn = mysql_query($sql_cn); $num = mysql_fetch_array($que_cn); $cid=convert_str($_POST['cid']); $maxcid=$num[0]+1; $isupd=true; if ($cid=="") { $cid=$maxcid; $isupd=false; }*/ if ($cid == "") { $isupd = false; } else { $isupd = true; } $isprivate = convert_str($_POST['isprivate']); $description = htmlspecialchars(convert_str($_POST['description'])); $lock_board_time = convert_str($_POST['lock_board_time']); $start_time = convert_str($_POST['start_time']); $end_time = convert_str($_POST['end_time']); $report = convert_str($_POST['report']);
table td, table th { border:solid 1px black; padding: 5px; } </style> </head> <body> <?php include_once 'functions/problems.php'; include_once 'functions/users.php'; include_once 'functions/contests.php'; $cid = convert_str($_GET['cid']); if (!contest_exist($cid) || $current_user->is_root() == false && !$current_user->match(contest_get_val($cid, "owner"))) { echo "<h1>You are not allowed to view this page.</h1>"; die; } $show_problem = new Problem(); foreach ((array) contest_get_problem_summaries($cid) as $cp) { $show_problem->set_problem($cp["pid"]); $html = "<center><h1>" . $cp["lable"] . ". " . $show_problem->get_val("title") . "</h1></center>"; if ($show_problem->get_val("description") != "") { $html .= latex_content($show_problem->get_val("description")); } if ($show_problem->get_val("input") != "") { $html .= "<h2 style='margin-top:10px'>Input</h2>" . latex_content($show_problem->get_val("input")); } if ($show_problem->get_val("output") != "") { $html .= "<h2 style='margin-top:10px'>Output</h2>" . latex_content($show_problem->get_val("output"));
function sidebar_contest_show($cid) { return sidebar_item_content_contest_info($cid) . (contest_get_val($cid, "type") == 1 ? sidebar_item_content_contest_points($cid) : "") . sidebar_item_content_vjstatus(); }
$query = "update user set total_submit=total_submit+1 where username='******' "; $result = $db->query($query); $host = $config["contact"]["server"]; $port = $config["contact"]["port"]; $fp = @fsockopen($host, $port, $errno, $errstr); if (!$fp) { if ($cid == "0") { $ret["msg"] = "Transmitted."; } else { $ret["msg"] = "Submitted."; } $ret["code"] = 0; echo json_encode($ret); die; } else { if (contest_get_val($cid, "has_cha") == "1") { $msg = $config["contact"]["pretest"] . "\n" . $nowid; } else { $msg = $config["contact"]["submit"] . "\n" . $nowid; } list($vname) = @$db->get_row("select vname from problem where pid='{$pid}'", ARRAY_N); $msg = $msg . "\n" . $vname; if (@fwrite($fp, $msg) === FALSE) { if ($cid == "0") { $ret["msg"] = "Transmitted."; } else { $ret["msg"] = "Submitted."; } $ret["code"] = 0; echo json_encode($ret); die;
?> ; var cnt=<?php if (contest_passed($cid)) { echo "0"; } else { if (contest_intermission($cid)) { echo strtotime(contest_get_val($cid, "challenge_start_time")); } else { if (contest_challenging($cid)) { echo strtotime(contest_get_val($cid, "challenge_end_time")); } else { if (contest_running($cid)) { echo strtotime(contest_get_val($cid, "end_time")); } else { echo strtotime(contest_get_val($cid, "start_time")); } } } } ?> ; var stp=-1; var refrate=<?php echo $config["status"]["refresh_rate"]; ?> ; var lim_times=<?php echo $config["status"]["max_refresh_times"]; ?> ;
$diffhour = (int) ($diff / 3600); $diffminute = (int) (($diff - $diffhour * 3600) / 60); $diffsecond = $diff - $diffhour * 3600 - $diffminute * 60; echo "Countdown: <span id='counttime'>{$diffhour}:{$diffminute}:{$diffsecond}</span> <span class='crunning'>Running</span>"; } else { $diff = strtotime(contest_get_val($cid, "start_time")) - $nowtime; $diffhour = (int) ($diff / 3600); $diffminute = (int) (($diff - $diffhour * 3600) / 60); $diffsecond = $diff - $diffhour * 3600 - $diffminute * 60; $canshow = false; echo "Countdown: <span id='counttime'>{$diffhour}:{$diffminute}:{$diffsecond}</span> <span class='cscheduled'>Not Started</span>"; } } } } if ($current_user->is_root() || $current_user->match(contest_get_val($cid, "owner"))) { ?> <br /><a target="_blank" href="contest_problem_merge.php?cid=<?php echo $cid; ?> ">[Show All Problem Description] ( For print, shown to owner only. )</a> <?php } ?> </div> <?php if ($canshow) { ?> <table id="cplist" class="table table-hover table-striped" width="100%"> <thead> <tr>
include_once "functions/contests.php"; include_once "functions/users.php"; include_once "functions/sidebars.php"; $cid = convert_str($_GET["cid"]); if (contest_exist($cid) && $current_user->is_root() || contest_get_val($cid, "isprivate") == 0 || contest_get_val($cid, "isprivate") == 1 && $current_user->is_in_contest($cid) || contest_get_val($cid, "isprivate") == 2 && contest_get_val($cid, "password") == $_COOKIE[$config["cookie_prefix"] . "contest_pass_{$cid}"]) { ?> <div class="span9"> <?php if (contest_passed($cid)) { ?> <h3 class="pagetitle">Contest Report</h3> <div id="contestrep" class="well"> <?php echo contest_get_val($cid, "report"); ?> </div> <?php } else { ?> <p class="alert alert-warning">Contest not finished, come back later :) .</p> <?php } ?> </div> <div class="span3"> <?php echo sidebar_contest_show($cid); ?>
} $map4 = array(); foreach ($map as $pid => $lable) { $mres = contest_get_problem_from_title($ccid, $titles[$pid]); if ($ccid != $cid) { $map4[$mres["pid"]] = $pid; } else { $map4[$pid] = $pid; } } $corrt = $needtime + strtotime(contest_get_val($ccid, "start_time")); $clocktu = strtotime(contest_get_val($ccid, "start_time")) + $locktu - $basetime; $cbase = strtotime(contest_get_val($ccid, "start_time")); /*if ($corrt>=$clocktu&&$corrt<strtotime(contest_get_val($ccid,"end_time"))) $corrt=$clocktu; else if($corrt>=$clocktu) $corrt=strtotime(contest_get_val($ccid,"start_time"))+strtotime(contest_get_val($cid,"end_time"))-$basetime;*/ $cidtype[$ccid] = contest_get_val($ccid, "type"); foreach ((array) contest_get_status_before_time($ccid, $corrt) as $row) { $row["0"] = $row["pid"] = $map4[$row["pid"]]; $row["username"] = trim(strtolower($row["username"])); $row[3] = $row['username'] = $row["username"] . "(" . $row["contest_belong"] . ")"; $row[5] = $row["contest_belong"]; $row[4] = $row["nickname"]; $row[1] = $row["result"]; $row[2] = $row['time_submit'] = strtotime($row["time_submit"]) - $cbase; $id = array_push($ary, $row); //$id 为行数 } //将查询结果存入 } // 扫描一遍查询结果 生成名称序二维表 $Name_ary = array();
} else { echo "<td style='display:none'>"; } echo "<a target='_blank' href='contest_show.php?cid=" . $Name_ary[$i]['contest_belong'] . "'>" . $Name_ary[$i]['contest_belong'] . "</a></td>"; //Contest echo "<td style='display:none'>" . $Name_ary[$i][3] . "</td>"; //ID echo "</tr>\n"; } echo "</tbody></table>\n"; ?> </div> </div> <?php if (contest_get_val($cid, "has_cha")) { ?> <div id="cchainfo" class="modal hide fade"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3>Challenge Info</h3> </div> <form id="cchaform" action="#" method="post"> <div class="modal-body"> <img src="" id="chasrcimage" /><br /> <?php if (contest_challenging($cid) || contest_intermission($cid)) { ?> <b>Data Type: </b><input type='radio' name='chadata_type' value='0' checked="checked" style="width:20px"> Raw Data <input type='radio' name='chadata_type' value='1' style="width:20px"> Souce Code <br /> <div id="cha_lang_select" style="display:none"> <b>Language: </b><select name="chadata_lang">
<?php include_once dirname(__FILE__) . "/../functions/contests.php"; include_once dirname(__FILE__) . "/../functions/users.php"; $ret = array(); $ret["code"] = 1; if ($current_user->is_root()) { $cid = convert_str($_GET['cid']); if ($cid == "" || contest_get_val($cid, "has_cha") == 0) { $ret["msg"] = "Invalid Request."; } else { $sql_r = "update status set result='Testing' where contest_belong='{$cid}' and result like 'Pretest Passed'"; $db->query($sql_r); $host = $config["contact"]["server"]; $port = $config["contact"]["port"]; $fp = fsockopen($host, $port, $errno, $errstr); if (!$fp) { $ret["msg"] = "Message sent."; $ret["code"] = 0; } else { $msg = $config["contact"]["test_all"] . "\n" . $cid . "\n"; @fwrite($fp, $msg); $ret["msg"] = "Message sent."; $ret["code"] = 0; fclose($fp); } } } else { $ret["msg"] = "Please login as root!"; } echo json_encode($ret);
<option value="5">Python</option> <option value="6">C# (Mono)</option> <option value="7">Fortran</option> <option value="8">Perl</option> <option value="9">Ruby</option> <option value="10">Ada</option> <option value="11">SML</option> <option value="12">Visual C++</option> <option value="13">Visual C</option> </select> </label> <button type='submit' class="btn btn-primary">Show</button> </form> </div> <?php if (contest_get_val($cid, "hide_others") && !$current_user->is_root()) { ?> <div class="tcenter"><b>In this contest, you can only view the submits from yourself.</b></div> <?php } ?> <div> <table class="table table-hover table-striped basetable cf" id="statustable" width="100%"> <thead> <tr> <th width='9%'>Username</th> <th width='7%'>RunID</th> <th width='6%'>ID</th> <th width='12%'>Result</th> <th width='9%'>Language</th> <th width='8%'>Time</th>
<?php include_once dirname(__FILE__) . "/../functions/contests.php"; $cid = convert_str($_POST['cid']); $opass = contest_get_val($cid, "password"); $pass = convert_str($_POST['password']); $ret = array(); if ($opass == pwd($pass)) { setcookie($config["cookie_prefix"] . "contest_pass_{$cid}", pwd($pass), 0, $config["base_path"]); $ret["code"] = 0; $ret["msg"] = "Success!"; } else { $ret["code"] = 1; $ret["msg"] = "Wrong password."; } echo json_encode($ret);
<?php include_once dirname(__FILE__) . "/../functions/users.php"; include_once dirname(__FILE__) . "/../functions/contests.php"; $fid = intval(convert_str($_GET["fcid"])); $tid = intval(convert_str($_GET["tcid"])); $ret["code"] = 1; if ($current_user->is_root()) { if ($fid > $tid) { $ret["msg"] = "CID {$fid} to {$tid} is invalid."; die(json_encode($ret)); } $ret["code"] = 0; $ret["msg"] = "Contest [ "; for ($cid = $fid; $cid <= $tid; $cid++) { if (contest_get_val($cid, "isvirtual") == 1 && contest_get_val($cid, "type") == 99) { $ret["msg"] .= $cid . " "; contest_delete($cid); } } $ret["msg"] .= "] have been successfully deleted."; } else { $ret["msg"] = "Permission denied."; } echo json_encode($ret);
<?php include_once dirname(__FILE__) . "/../functions/users.php"; include_once dirname(__FILE__) . "/../functions/problems.php"; include_once dirname(__FILE__) . "/../functions/contests.php"; $cid = convert_str($_POST['cid']); $ret = array(); $ret["code"] = 1; if (contest_exist($cid) && !contest_passed($cid) && ($current_user->is_root() || $current_user->match(contest_get_val($cid, "owner")))) { $title = htmlspecialchars(convert_str($_POST['title'])); $isprivate = 0; $description = htmlspecialchars(convert_str($_POST['description'])); $lock_board_time = convert_str($_POST['lock_board_time']); $start_time = convert_str($_POST['start_time']); $end_time = convert_str($_POST['end_time']); if (!contest_started($cid) && $_POST["localtime"] == 1) { $dt = new DateTime($start_time, new DateTimeZone($_POST['localtz'])); $dt->setTimezone(new DateTimeZone($mytimezone)); $start_time = $dt->format('Y-m-d H:i:s'); $dt = new DateTime($lock_board_time, new DateTimeZone($_POST['localtz'])); $dt->setTimezone(new DateTimeZone($mytimezone)); $lock_board_time = $dt->format('Y-m-d H:i:s'); $dt = new DateTime($end_time, new DateTimeZone($_POST['localtz'])); $dt->setTimezone(new DateTimeZone($mytimezone)); $end_time = $dt->format('Y-m-d H:i:s'); } $ctype = convert_str($_POST['ctype']); $hide_others = convert_str($_POST['hide_others']); $pass = pwd(convert_str($_POST['password'])); if ($_POST['password'] != "") { $isprivate = 2;
<?php include_once dirname(__FILE__) . "/../functions/users.php"; include_once dirname(__FILE__) . "/../functions/contests.php"; $cid = convert_str($_GET["cid"]); $ret["code"] = 1; $ret["msg"] = "Permission denied."; if ($current_user->is_root() || $current_user->match(contest_get_val($cid, "owner")) && !contest_started($cid)) { $ret["code"] = 0; contest_delete($cid); $ret["msg"] = "Contest {$cid} has been successfully deleted."; } echo json_encode($ret);
echo contest_get_val($cid, "end_time"); ?> '/><span class="add-on"><i class="icon-th"></i></span></div></td></tr> <tr><td>( Length should be between 30 minutes and 15 days )</td></tr> <tr><td><div class="input-append input-prepend date datepick"><span class="add-on">Lock Board Time: </span><input id="prependedInput" type="text" name="lock_board_time" value='<?php echo contest_get_val($cid, "lock_board_time"); ?> '/><span class="add-on"><i class="icon-th"></i></span></div></td></tr> <tr><td>( Set it later than end time if you don't want to lock board )</td></tr> <tr><td><label class="radio inline"><input type="radio" name="localtime" value="1" />Use local timezone</label><label class="radio inline"><input type="radio" name="localtime" value="0" checked="checked" /> Use server timezone</label></td></tr> <tr><td>Your timezone: <span id="localtz"></span><input name="localtz" type="hidden" id="tzinp" /></td></tr> <tr><td><label class="radio inline"><input type="radio" name="hide_others" value="1" <?php echo contest_get_val($cid, "hide_others") == 1 ? 'checked="checked"' : ''; ?> /> Hide others' status</label><label class="radio inline"><input type="radio" name="hide_others" value="0" <?php echo contest_get_val($cid, "hide_others") == 0 ? 'checked="checked"' : ''; ?> /> Show others' status</label></td></tr> <?php } ?> <tr><td><div class="input-prepend"><span class="add-on">Password: </span><input type="password" name="password" /></div></td></tr> <tr><td>( Leave it blank if not needed )</td></tr> </table> </div> <?php if (!contest_started($cid)) { $ccrow = (array) contest_get_problem_basic($cid); $nn = $config["limits"]["problems_on_contest_add"]; ?>