<?php include_once dirname(__FILE__) . "/../functions/users.php"; include_once dirname(__FILE__) . "/../functions/contests.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}"])) { 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)) {
include_once dirname(__FILE__) . "/../functions/problems.php"; include_once dirname(__FILE__) . "/../functions/contests.php"; $ret = array(); $ret["code"] = 1; if ($current_user->is_root()) { $cid = convert_str($_GET['cid']); $pid = convert_str($_GET['pid']); $rac = convert_str($_GET['rac']); $type = convert_str($_GET['type']); if ($pid == "") { $ret["msg"] = "Invalid request."; echo json_encode($ret); exit; } if ($type == 2) { if (!contest_exist($cid)) { $ret["msg"] = "Invalid contest."; echo json_encode($ret); exit; } $pid = contest_get_pid_from_label($cid, $pid); if ($pid == null) { $ret["msg"] = "No such problem in this contest."; echo json_encode($ret); exit; } } else { if (!problem_exist($pid)) { $ret["msg"] = "No such problem."; echo json_encode($ret); exit;
function contest_get_visible_clarify($cid, $user) { global $db; if (!contest_exist($cid)) { return null; } $query = "select * from contest_clarify where cid='{$cid}' and (username='******' or ispublic=1) order by ccid desc"; return $db->get_results($query, ARRAY_A); }
<?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/problems.php"; include_once dirname(__FILE__) . "/../functions/contests.php"; $ret = array(); $ret["code"] = 1; if ($current_user->is_root()) { $cid = convert_str($_GET['cid']); $type = convert_str($_GET['type']); if ($cid != "" && contest_exist($cid)) { $sql_r = "update challenge set cha_result='Pending' where cid='{$cid}'"; } else { $ret["msg"] = "Invalid request."; die(json_encode($ret)); } if (contest_get_val($cid, "has_cha") == 0) { $ret["msg"] = "No challenge in this contest."; die(json_encode($ret)); } $que_r = $db->query($sql_r); $sql = "select cha_id,runid from challenge where cha_result='Pending' and cid='{$cid}'"; //$res=mysql_query($sql); //if (db_problem_isvirtual($pid)) $port=$vserver_port; else $port=$server_port; $host = $config["contact"]["server"]; $port = $config["contact"]["port"]; foreach ((array) $db->get_results($res, ARRAY_A) as $row) { $fp = fsockopen($host, $port, $errno, $errstr); if ($fp) { list($vname) = $db->get_row("select vname from problem,status where runid='" . $row['runid'] . "' and problem.pid=status.pid", ARRAY_N); $msg = $config["contact"]["challenge"] . "\n" . $row['cha_id'] . "\n" . $vname . "\n";
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"));
teams, Chrome RECOMMENDED! ) </label> </div> </div> <div class="modal-footer"> <input name='login' class="btn btn-primary" type='submit' value='Confirm & Show' /> </div> <input type='hidden' name='cid' value='<?php echo $cid; ?> ' /> </form> </div> <?php } else { if (contest_exist($cid) && contest_get_val($cid, "password") != "") { ?> <div class="span12"> <form id="cpasssub"> <div class="input-append"><input type="password" name="cpass" id="contest_password" placeholder="Input password" /><button class="btn btn-primary" type="submit">Confirm</button></div> </form> </div> <?php } else { ?> <div class="span12"> <p class="alert alert-error">Contest Unavailable!</p> </div> <?php