Please Login First!"; exit(1); } echo "

" . "Edit-" . $MSG_CONTEST . "

"; include_once("vditor.php"); ?> ", "", $description); $description = str_replace("

", "
", $description); $description = str_replace(",", ",", $description); $sql = "UPDATE `contest` SET `title`=?,`description`=?,`start_time`=?,`end_time`=?,`private`=?,`langmask`=?,`password`=? WHERE `contest_id`=?"; //echo $sql; pdo_query($sql, $title, $description, $starttime, $endtime, $private, $langmask, $password, $cid); $sql = "DELETE FROM `contest_problem` WHERE `contest_id`=?"; pdo_query($sql, $cid); $plist = trim($_POST['cproblem']); $pieces = explode(',', $plist); if (count($pieces) > 0 && strlen($pieces[0]) > 0) { $sql_1 = "INSERT INTO `contest_problem`(`contest_id`,`problem_id`,`num`) VALUES (?,?,?)"; $plist = ""; pdo_query("update solution set num=-1 where contest_id=?", $cid); $num = 0; for ($i = 0; $i < count($pieces); $i++) { $sql = "select problem_id from problem where problem_id=?"; $pid = intval($pieces[$i]); $has = pdo_query($sql, $pid); if (count($has) > 0) { if ($plist) $plist .= ","; $plist .= intval($pieces[$i]); pdo_query($sql_1, $cid, $pieces[$i], $num); $sql = "UPDATE `contest_problem` SET `c_accepted`=(SELECT count(1) FROM `solution` WHERE `problem_id`=? and contest_id=? AND `result`=4) WHERE `problem_id`=? and contest_id=?"; pdo_query($sql, $pid, $cid, $pid, $cid); $sql = "UPDATE `contest_problem` SET `c_submit`=(SELECT count(1) FROM `solution` WHERE `problem_id`=? and contest_id=?) WHERE `problem_id`=? and contest_id=?"; pdo_query($sql, $pid, $cid, $pid, $cid); $sql_2 = "update solution set num=? where contest_id=? and problem_id=?;"; pdo_query($sql_2, $num, $cid, $pid); $num++; } else { print ("Problem not exists:" . $pieces[$i] . "
\n"); } } $sql = "update `problem` set defunct='N' where `problem_id` in ($plist)"; pdo_query($sql); } $sql = "DELETE FROM `testusers` WHERE `contest_id`=?"; pdo_query($sql, $cid); $pieces = explode("\n", trim($_POST['ulist'])); $pieces = array_unique($pieces); if (count($pieces) > 0 && strlen($pieces[0]) > 0) { $sql_1 = "INSERT INTO `testusers`(`user_id`,`contest_id`) VALUES (?,?)"; for ($i = 0; $i < count($pieces); $i++) { pdo_query($sql_1, trim($pieces[$i]), $cid); } } echo ""; exit(); } else { $cid = intval($_GET['cid']); $sql = "SELECT * FROM `contest` WHERE `contest_id`=?"; $result = pdo_query($sql, $cid); if (count($result) != 1) { echo "No such Contest!"; exit(0); } $row = $result[0]; $starttime = $row['start_time']; $endtime = $row['end_time']; $private = $row['private']; $password = $row['password']; $langmask = $row['langmask']; $description = $row['description']; $title = htmlentities($row['title'], ENT_QUOTES, "UTF-8"); $plist = ""; $sql = "SELECT `problem_id` FROM `contest_problem` WHERE `contest_id`=? ORDER BY `num`"; $result = pdo_query($sql, $cid); foreach ($result as $row) { if ($plist) $plist .= ","; $plist .= $row[0]; } $ulist = ""; $sql = "SELECT `user_id` FROM `testusers` WHERE `contest_id`=? order by user_id"; $result = pdo_query($sql, $cid); foreach ($result as $row) { if ($ulist) $ulist .= "\n"; $ulist .= $row[0]; } } ?>
>

" . $MSG_CONTEST . "-" . $MSG_TITLE . "" ?>

: Hour:   Minute:

: Hour:   Minute:




" . $MSG_CONTEST . "-" . $MSG_Description . "" ?>



: : '>