Example #1
0
}
$end = $app->setting->get("endTime", time() + 10);
if ($end < time()) {
    die('<center><h1><a href="index.php" style="color: #000000;">Contest have finished !</a></h1></center></body></html>');
}
$db = new MySQL();
$info = $db->from("Problem")->where("`id` = '" . $_GET['id'] . "'")->select()->fetch_one();
$pro = new Problem($info['pid'], $info['oj']);
if (isset($_POST['lang']) && isset($_POST['code'])) {
    if (isset($_SESSION['lasttime'])) {
        if (time() - intval($_SESSION['lasttime']) < 10) {
            die('<center><a href=\'index.php\'>Please submit 10s later !</a></center>');
        }
    }
    $_SESSION['lasttime'] = time();
    $pro->submitCode($_POST['lang'], $_POST['code']);
    header("Location: result.php?id=" . $_SESSION['last_id']);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <?php 
require_once "head.html";
?>
        <title>Submit Code</title>
    </head>
    <body>
        <?php 
require_once "navbar.php";
?>