コード例 #1
0
     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;
     }
 }
 if ($cid != "") {
     if ($rac == 0) {
         $sql_r = "update status set result='Rejudging' where pid='{$pid}' and contest_belong='{$cid}' and result!='Accepted' ";
     } else {
         $sql_r = "update status set result='Rejudging' where pid='{$pid}' and contest_belong='{$cid}' ";
     }
 } else {
     $cid = 0;
     if ($rac == 0) {
         $sql_r = "update status set result='Rejudging' where pid='{$pid}' and contest_belong='{$cid}' and result!='Accepted' ";
コード例 #2
0
 } else {
     if (!problem_exist($pid[0]) || problem_hidden($pid[0])) {
         $ret["msg"] = "First problem doesn't exist.";
     } else {
         if ($edt - $stt < 30 * 60 || $edt - $stt > 15 * 24 * 60 * 60 || $lbt != 0 && ($lbt < $stt && $lbt > $edt)) {
             $ret["msg"] = "Invalid contest length.";
         } else {
             $sql_add_con = "insert into contest (title,description,isprivate,lock_board_time,start_time,end_time,hide_others,owner,isvirtual,type,password) values ('{$title}'" . ",'{$description}','{$isprivate}','{$lock_board_time}','{$start_time}','{$end_time}','{$hide_others}','{$nowuser}',1,'{$ctype}','{$pass}')";
             //$sql_add_con = change_in($sql_add_con);
             //echo "<br/>".$sql_add_con."<br/>";
             $pd = false;
             for ($i = 0; $i < $n; $i++) {
                 if ($pid[$i] == "") {
                     continue;
                 }
                 if (!problem_exist($pid[$i]) || problem_hidden($pid[$i])) {
                     $pd = true;
                 } else {
                     if ($ptype[$i] == 1 || $ptype[$i] == 3) {
                         if (!is_numeric($base[$i]) || !is_numeric($minp[$i]) || !is_numeric($paraa[$i]) || !is_numeric($parab[$i])) {
                             //                        echo $base[$i].is_numeric($base[$i]);
                             $pd = true;
                         }
                     } else {
                         if ($ptype[$i] == 2) {
                             if (!is_numeric($base[$i]) || !is_numeric($minp[$i]) || !is_numeric($paraa[$i]) || !is_numeric($parab[$i]) || !is_numeric($parac[$i]) || !is_numeric($parad[$i]) || !is_numeric($parae[$i])) {
                                 //echo $i;
                                 $pd = true;
                             }
                             if (abs(doubleval($paraa[$i]) + doubleval($parab[$i]) - 1.0) > 0.001 || doubleval($parad[$i]) < 0 || doubleval($parac[$i]) < 0.0001) {
                                 $pd = true;
コード例 #3
0
    $sfreq = 10;
}
if ($sfreq == "" || $sfreq < 10) {
    $sfreq = 10;
}
$pnum = $mcid = 0;
$ret = array();
$ret["code"] = 1;
if ($current_user->is_root()) {
    if ($_POST['name'] == "") {
        $ret["msg"] = "No name!";
        die(json_encode($ret));
    }
    $pnum = 0;
    while ($_POST['pid' . $pnum] != "") {
        if (!problem_exist($_POST['pid' . $pnum])) {
            $ret["msg"] = "Invalid problem ID " . $_POST['pid' . $pnum] . ".";
            die(json_encode($ret));
        }
        $pnum++;
    }
    if ($_POST['start_time'] == "" || $_POST['end_time'] == "") {
        $ret["msg"] = "Invalid Time!";
        die(json_encode($ret));
    }
    $sttime = strtotime($_POST['start_time']);
    $edtime = strtotime($_POST['end_time']);
    if ($sttime == "" || $edtime == "") {
        $ret["msg"] = "Invalid Time!";
        die(json_encode($ret));
    }
コード例 #4
0
ファイル: topic_reply.php プロジェクト: KinKir/bnuoj-web-v3
include_once dirname(__FILE__) . "/../functions/global.php";
include_once dirname(__FILE__) . "/../functions/users.php";
include_once dirname(__FILE__) . "/../functions/problems.php";
$con = convert_str($_POST['content']);
$title = convert_str($_POST['title']);
$ret = array();
$ret["code"] = 1;
if (!$current_user->is_valid()) {
    $ret["msg"] = "Not logged in.";
} else {
    if ($title == "") {
        $ret["msg"] = "No Title.";
    } else {
        $pid = convert_str($_GET['pid']);
        if ($pid != "0" && $pid != "" && !problem_exist($pid)) {
            $ret["msg"] = "No Such Problem!";
            echo json_encode($ret);
            die;
        }
        $fid = convert_str($_GET['id']);
        $rid = convert_str($_GET['rid']);
        $uname = $nowuser;
        $sql = "INSERT INTO discuss (`id` ,`fid` ,`rid` ,`time` ,`title` ,`content` ,`uname` ,`pid`)VALUES (NULL ,'{$fid}',  '{$rid}', NOW( ) ,  '{$title}',  '{$con}',  '{$uname}',  '{$pid}')";
        $db->query($sql);
        $sql = "update time_bbs set time=NOW() where rid = {$rid}";
        $db->query($sql);
        $ret["code"] = 0;
        $ret["msg"] = "Success!";
    }
}
コード例 #5
0
ファイル: discuss.php プロジェクト: RX78NY1/hustoj
<?php

require_once "discuss_func.inc.php";
if (isset($_REQUEST['pid'])) {
    $pid = intval($_REQUEST['pid']);
} else {
    $pid = 0;
}
if (isset($_REQUEST['cid'])) {
    $cid = intval($_REQUEST['cid']);
} else {
    $cid = 0;
}
$prob_exist = problem_exist($pid, $cid);
if ($cid != '' && $cid != null && $prob_exist) {
    require_once "contest-header.php";
} else {
    require_once "oj-header.php";
}
echo "<title>HUST Online Judge WebBoard</title>";
?>

<center>
<div style="width:90%">
<?php 
if ($prob_exist) {
    ?>
<div style="text-align:left;font-size:80%">
[ <a href="newpost.php<?php 
    if ($pid != 0 && $cid != null) {
        echo "?pid=" . $pid . "&cid=" . $cid;
コード例 #6
0
     $sql_con = "update contest set \n            title='{$title}',\n            description='{$description}',\n            isprivate='{$isprivate}',\n            start_time='{$start_time}',\n            end_time='{$end_time}',\n            lock_board_time='{$lock_board_time}',\n            hide_others='{$hide_others}',\n            isvirtual='0',\n            report='{$report}',\n            type='{$ctype}',\n            has_cha='{$has_cha}',\n            challenge_start_time='{$challenge_start_time}',\n            challenge_end_time='{$challenge_end_time}'\n            where cid='{$cid}'";
 } else {
     $sql_con = "insert into contest (title,description,isprivate,lock_board_time,start_time,end_time,hide_others,isvirtual,report,type,has_cha,challenge_start_time,challenge_end_time) values\n            ('{$title}','{$description}','{$isprivate}','{$lock_board_time}','{$start_time}','{$end_time}','{$hide_others}',0,'{$report}','{$ctype}','{$has_cha}','{$challenge_start_time}','{$challenge_end_time}')";
 }
 //$sql_con = change_in($sql_con);
 $db->query($sql_con);
 if ($cid == "") {
     $cid = $db->insert_id;
 }
 //echo $sql_con."\n";
 $pd = false;
 for ($i = 0; $i < $n; $i++) {
     if ($pid[$i] == "") {
         continue;
     }
     if (!problem_exist($pid[$i])) {
         $ret["msg"] .= "Failed to add Problem " . $lable[$i] . ", pid: " . $pid[$i] . " not exists.<br />";
     }
     //else echo "Problem ".$lable[$i]." added, pid: ".$pid[$i].".<br />";
 }
 for ($i = 0; $i < $n; $i++) {
     if ($pid[$i] == "") {
         continue;
     }
     if ($ctype == 0) {
         $sql = "insert into contest_problem (cid ,pid,lable) values ('" . $cid . "','" . $pid[$i] . "','" . $lable[$i] . "')";
     } else {
         $sql = "insert into contest_problem (cid ,pid,lable,type,base,minp,para_a,para_b,para_c,para_d,para_e) values\n                ('" . $cid . "','" . $pid[$i] . "','" . $lable[$i] . "','" . $ptype[$i] . "','" . $base[$i] . "','" . $minp[$i] . "','" . $paraa[$i] . "','" . $parab[$i] . "','" . $parac[$i] . "','" . $parad[$i] . "','" . $parae[$i] . "')";
     }
     $db->query($sql);
 }
コード例 #7
0
ファイル: problem_show.php プロジェクト: KinKir/bnuoj-web-v3
" class="btn">Statistics</a>
                <a href="discuss.php?pid=<?php 
    echo $pid;
    ?>
" class="btn">Discuss</a>
              </div>
<?php 
    if ($current_user->is_root()) {
        ?>
                <a href="admin_index.php?pid=<?php 
        echo $pid;
        ?>
#problemtab" class="btn btn-primary">Edit</a>
<?php 
    }
    if (problem_exist(intval($pid) + 1)) {
        ?>
              <a href="problem_show.php?pid=<?php 
        echo intval($pid) + 1;
        ?>
" class="btn">Next</a>
<?php 
    }
    ?>
            </div>
<?php 
}
?>
        </div>

    <div id="submitdialog" class="modal hide fade" style="display:none">