Example #1
0
<?php

require "./navigation.php";
include_once "./FCKeditor/fckeditor.php";
$cid = tryget('cid', 0);
$rs = new RecordSet($conn);
if ($cid) {
    $contest = new ContestsTbl($cid);
    $contest->Get() or error("contest not exists");
    $contest_title = $contest->detail['title'];
    $problems_n = gen_new_cpid($cid);
} else {
    $contest_title = "";
    $problems_n = gen_new_pid();
}
?>
  

<script type="text/javascript">

    var datanum=0;

    function insert()
    {
        var box = "";
        box += "<tr>";
        box += "<td>Input Data"+datanum+"</td>";
        box += "<td><input type=file name=\"input_data"+datanum+"\" id=\"input_data"+datanum+"\"></td>";
        box += "</tr>";

        box += "<tr>";
Example #2
0
function AuthContest(&$arg)
{
    $cid = safefetch($arg, 'cid', "Fail");
    $pwd = safefetch($arg, 'pwd', "Fail");
    $contest = new ContestsTbl($cid);
    if (!$contest->Get()) {
        Fail("No such contest");
    }
    if ($contest->detail['authtype'] != 'password') {
        Fail("No password is needed");
    }
    if ($contest->detail['pwd'] != $pwd) {
        Fail("Password Incorrect");
    }
    Output("cid", $cid);
    $_SESSION["access{$cid}"] = 1;
}
Example #3
0
<?php

require "./navigation.php";
?>

<?php 
include_once "./FCKeditor/fckeditor.php";
$cid = @$_GET['cid'];
$pid = @$_GET['pid'];
if ($cid) {
    $problem = new ContestProblem($cid);
    $contest = new ContestsTbl($cid);
    $contest->Get();
    $contest_title = $contest->detail['title'];
} else {
    $problem = new ProblemTbl();
    $cid = 0;
}
if (!$problem->Get($pid)) {
    MsgAndRedirect("No such problem", "index.php");
}
$title = $problem->detail['title'];
?>
<form action="process.php?act=EditContestProblem" method="post" enctype="multipart/form-data">
    <input type="hidden" name="avail" value="1" />
    <input name="cid" type="hidden" id="cid" value="<?php 
echo $cid;
?>
">
    <table id="tb" width="100%" class="ui-widget tblcontainer ui-widget-content ui-corner-all">
        <caption>Edit problems</caption>
Example #4
0
function StartContest(&$arg)
{
    $cid = safefetch($arg, 'cid');
    $contest = new ContestsTbl($cid);
    $contest->Get() or error("No such contest");
    $contest->update['starttime'] = date('Y-m-d H:i:s');
    $contest->Update();
    MsgAndRedirect("contests.php");
}
Example #5
0
$cid = $_GET["cid"];
$pid = $_GET["pid"];
if ($p == "") {
    $p = 1;
}
$rs = new RecordSet($conn);
$rs->nPageSize = 16;
if ($cid) {
    $rs->PageCount("SELECT count(*) FROM contest_status");
    $rs->SetPage($p);
    if ($pid) {
        $rs->dpQuery("SELECT sid, contest_status.uid, username, pid, language, status, run_time, run_memory, time FROM contest_status,user WHERE contest_status.uid=user.uid AND cid='{$cid}' AND pid='{$pid}' ORDER BY time DESC");
    } else {
        $rs->dpQuery("SELECT sid, contest_status.uid, username, pid, language, status, run_time, run_memory, time FROM contest_status,user WHERE contest_status.uid=user.uid AND cid='{$cid}' ORDER BY time DESC");
    }
    $contest = new ContestsTbl();
    $contest->Get($cid);
} else {
    $rs->PageCount("SELECT count(*) FROM status");
    $rs->SetPage($p);
    $rs->dpQuery("SELECT sid, status.uid, username, pid, language, status, run_time, run_memory, time FROM status,user WHERE status.uid=user.uid ORDER BY sid DESC");
}
?>
<html>
	<head>
		<title>Status</title>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
		<link rel="stylesheet" href="style.css">
	</head>
	<body color="#FFFFFF" bgcolor="#005DA9" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
Example #6
0
<?php

require "./navigation.php";
$cid = safeget("cid");
$contest = new ContestsTbl($cid);
if (!$contest->Get()) {
    error("No such contest");
}
?>

<h1> Import User list for <?php 
echo $contest->detail['title'];
?>
 </h1>
<h2> Example format of csv </h2>
<table class="ui-widget">
    <thead class="ui-widget-header">
        <tr><th>username</th><th>password</th><th>email</th><th>nickname</th><th>signature</th></tr>
    </thead>
    <tbody class="ui-widget-content tr_odd">
        <tr><td>hovey</td><td>123456</td><td>hoveychen@soj.me</td><td>Hovey Chen</td><td>A lazy boy</td></tr>
        <tr><td>more</td><td>and</td><td>more@fun</td><td>more</td><td>fun</td></tr>
    </tbody>
</table>
<p>Notice that the csv file should be encoded as gbk( i.e. from windows excel)</p>
<p>If the password field is left emtpy, automatic generated password will be filled up.</p>
<table class="ui-widget">
    <thead class="ui-widget-header"> <tr><td> options </td> <td> values </td> </tr></thead>
    <tbody class="ui-widget-content tr_odd">
	<form id="importuser" name="importuser" action="<?php 
echo $_SERVER['PHP_SELF'];
Example #7
0
<?php

require "./navigation.php";
$cid = safeget('cid');
$contest = new ContestsTbl($cid);
$contest->Get() or error("No such contest");
if (isset($_POST['pwd'])) {
    $pwd = safepost('pwd');
    if ($contest->detail['authtype'] != 'password') {
        error("No password is needed");
    }
    if ($contest->detail['pwd'] == $pwd) {
        $_SESSION["access{$cid}"] = 1;
        MsgAndRedirect("contest_detail.php?cid={$cid}");
    } else {
        $error_msg = "Password Incorrect";
    }
}
if (isset($_SESSION["access{$cid}"]) && $_SESSION["access{$cid}"] == 1 || $contest->detail['authtype'] != 'password') {
    // already auth
    MsgAndRedirect("contest_detail.php?cid={$cid}");
}
?>

<div class="background_container">
    <div class="ui-corner-all ui-widget-content">


        <table width="900" border="0" cellspacing="0" cellpadding="0">
            <tr> 
                <td width="300" height="100" bgcolor="#F0F0F0"><img src="images/register_01.jpg" width="300" height="100"></td>
Example #8
0
<?php

require "./navigation.php";
$cid = @$_GET["cid"];
if (isset($login_uid)) {
    $user = new UserTbl();
    $user->Get($login_uid);
    $list = $user->detail['list'];
}
$rs = new RecordSet($conn);
$rs->nPageSize = 20;
if ($cid) {
    $contest = new ContestsTbl();
    if ($contest->Get($cid) < 0) {
        error("No such contest ID");
    }
    if (!is_admins()) {
        $now = time();
        if ($now < strtotime($contest->detail['starttime'])) {
            error("The contest is not started");
        }
    }
    $rs->PageCount("SELECT count(*) FROM contest_problems");
    $rs->SetPage($p);
    $rs->dpQuery("SELECT pid, title, accepted, submissions, avail FROM contest_problems WHERE cid='{$cid}'");
} else {
    $rs->PageCount("SELECT count(*) FROM problems");
    $rs->SetPage($p);
    $rs->dpQuery("SELECT pid, title, accepted, submissions, avail FROM problems");
}
?>
Example #9
0
function is_contest_ended($cid)
{
    if (!$cid) {
        return true;
    }
    $contest = new ContestsTbl();
    if ($contest->Get($cid) < 0) {
        error("No such contest ID");
    }
    $now = time();
    $during = sscanf($contest->detail['during'], "%d:%d:%d", $h, $m, $s);
    $endtime = strtotime($contest->detail['starttime']);
    $endtime += $h * 3600 + $m * 60 + $s;
    if ($now < $endtime) {
        return false;
    } else {
        return true;
    }
}
Example #10
0
<?php

require "./navigation.php";
$cid = safeget("cid");
$contestTbl = new ContestsTbl($cid);
if (!$contestTbl->Get()) {
    error("Contest not found");
}
$course_id = $contestTbl->detail['course_id'];
if (!is_contest_modifiable($cid)) {
    error("No permission");
}
$contestProblemTbl = new ContestProblemTbl($cid);
$cpidIndex = array();
if ($contestProblemTbl->Get()) {
    do {
        $cpidIndex[$contestProblemTbl->detail['pid']] = $contestProblemTbl->detail['cpid'];
    } while ($contestProblemTbl->MoreRows());
}
$contest = $contestTbl->detail;
$p = tryget("p", 1);
$rs = new RecordSet($conn);
$query_str = "SELECT problems.pid FROM problems LEFT JOIN contest_problems ON contest_problems.pid = problems.pid WHERE avail = 1 AND problems.cid = {$cid} ";
$count_str = "SELECT count(*) FROM problems WHERE avail = 1 AND cid = {$cid} ";
$rs->nPageSize = 20;
$rs->PageCount($count_str);
$rs->SetPage($p);
$query_str .= "ORDER BY cpid ASC";
$rs->dpQuery($query_str);
$now = time();
?>