Ejemplo n.º 1
0
<?php 
include_once dirname(__FILE__) . "/../functions/users.php";
include_once dirname(__FILE__) . "/../functions/contests.php";
$question = convert_str($_POST['question']);
$cid = convert_str($_GET['cid']);
if ($cid == "") {
    $cid = "0";
}
$ret = array();
$ret["code"] = 1;
if (!$current_user->is_valid()) {
    $ret["msg"] = "Please login.";
    echo json_encode($ret);
    die;
} else {
    if ($cid == "0" || !contest_running($cid)) {
        $ret["msg"] = "Contest is not running.";
        echo json_encode($ret);
        die;
    } else {
        if (!(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}"])) {
            $ret["msg"] = "You are not in this contest.";
            echo json_encode($ret);
            die;
        }
    }
}
$query = "insert into contest_clarify set cid='{$cid}',question='{$question}',username='******',ispublic=0";
$db->query($query);
$ret["code"] = 0;
$ret["msg"] = "Success!";
Ejemplo n.º 2
0
';
var cpass= <?php 
echo contest_passed($cid) ? "true" : "false";
?>
;
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