Example #1
0
                exec("tree -ah > /tmp/cogs_back_info.log");
                flush();
                echo "<p><pre>" . file_get_contents("/tmp/cogs_back_info.log") . "</pre><p>";
                if (file_exists("{$filename}.tar.gz")) {
                    echo "<span class=ok>成功导出全部测试数据!</span>";
                } else {
                    echo "<span class=no>导出测试数据失败!</span>";
                }
            } else {
                if ($_POST['backtype'] == "showback") {
                    echo "<h4>备份文件夹<code>{$SET['dir_databackup']}</code>下的内容如下:</h4>";
                    flush();
                    exec("tree -ah > /tmp/cogs_back_info.log");
                    echo "<pre>" . file_get_contents("/tmp/cogs_back_info.log") . "</pre>";
                } else {
                    异常("未定义的操作!", 取路径("admin/backup.php"));
                }
            }
        }
    }
}
?>
<a href="backup.php">返回备份与恢复页面</a>
</div>

<?php 
chdir($ima);
include_once "../include/footer.php";
?>

Example #2
0
require_once "../include/header.php";
gethead(1, "", "比赛成绩");
$p = new DataAccess();
$r = new DataAccess();
$sql = "select comptime.starttime,comptime.endtime,compbase.contains,comptime.showscore from compbase,comptime where comptime.cbid=compbase.cbid and comptime.ctid={$_GET[ctid]}";
$cnt = $p->dosql($sql);
if (!$cnt) {
    异常("未查询到记录!");
}
$d = $p->rtnrlt(0);
if (!$d['showscore'] && !有此权限('查看比赛')) {
    异常("成绩还未公布!");
}
if (time() < $d['starttime'] && !有此权限('查看比赛')) {
    异常("比赛尚未开始,不能查看关于题目的任何信息!");
}
$end = time() > $d['endtime'];
$q = new DataAccess();
$pbs = explode(":", $d['contains']);
?>
<div class='row-fluid'>
<table id="contest_report" class='table table-striped table-condensed table-bordered fiexd'>
<thead>
  <tr>
    <th style="min-width: 5ex;">名次</th>
    <th>用户</th>
<?php 
$cnt_prob = 0;
foreach ($pbs as $k => $v) {
    $v = (int) $v;
Example #3
0
        if ($d[lang] == 1) {
            $ext = "c";
        } else {
            if ($d[lang] == 2) {
                $ext = "cpp";
            }
        }
    }
    $fp = fopen("{$SET['dir_competition']}{$d[ctid]}/{$d[uid]}/{$d[filename]}.{$ext}", "r");
    if (is_resource($fp)) {
        $code = rfile($fp);
    }
    fclose($fp);
    $code = mb_convert_encoding($code, "utf-8", "gbk");
} else {
    异常("提交记录不存在");
}
gethead(1, "sess", "比赛代码", $d['uid']);
$LIB->hlighter();
?>
<div class='row-fluid'>
<table class='table table-striped table-condensed table-bordered fiexd'>
<tr>
    <th width="60px">比赛</th>
    <td><b><?php 
echo $d['cname'];
?>
</b></td>
    <th width="60px">评测结果</th>
    <td class='wrap'><?php 
评测结果($d['result'], 100);
Example #4
0
<?php

require_once "../include/header.php";
gethead(1, "sess", "评测");
if (!$_POST['pid']) {
    异常("你来错地方了!");
}
$LIB->hlighter();
$LIB->func_socket();
$p = new DataAccess();
$sql = "select * from problem where pid={$_POST['pid']}";
$p->dosql($sql);
$d = $p->rtnrlt(0);
if (!$d['submitable'] && !有此权限('查看题目')) {
    异常("不可提交!", 取路径("problem/index.php"));
}
$lang = langstrtonum($_POST['lang']);
$info = array();
$info['pid'] = $_POST['pid'];
$info['sid'] = $_POST['sid'];
$info['uid'] = $_SESSION['ID'];
$info['language'] = $lang;
$info['pname'] = $d['filename'];
$info['datacnt'] = $d['datacnt'];
$info['timelimit'] = $d['timelimit'];
$ptitle = $d['probname'];
$info['memorylimit'] = $d['memorylimit'];
$info['plugin'] = $d['plugin'];
$info['compiledir'] = $SET['dir_source'];
$info['mode'] = "normal";
if ($_POST['testmode'] == '1' && 有此权限('测试题目')) {
Example #5
0
<?php

require_once "../include/header.php";
gethead(0, "sess", "");
if (!有此权限('查看用户') && $_SESSION['ID'] != $_GET['uid']) {
    异常("没有权限,且不是本人!", 取路径("user/detail.php?uid={$_GET['uid']}"));
}
chdir($SET['dir_source']);
$uid = (int) $_GET['uid'];
$dir = "{$uid}";
$src = "tmp.zip";
exec("rm {$src}");
$zip = "zip -r {$src} {$dir}";
exec($zip);
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=\"{$dir}.zip\"");
@readfile($src);
?>

Example #6
0
<?php

require_once "../include/header.php";
gethead(1, "sess", "登录日志", $_GET['uid']);
$p = new DataAccess();
if ($_GET['uid'] != $_SESSION['ID'] && !有此权限("查看用户")) {
    异常("不是本人并且没有权限查看!", 取路径("user/detail.php?uid={$_GET['uid']}"));
}
?>

<form action="" method="get" class='form-inline center'>
检索: 用户UID
<input name="uid" type="number" value="<?php 
echo $_GET['uid'];
?>
" class='span1' />
<button type="submit" class='btn btn-primary'>检索</button>
</form>
<?php 
$sql = "select login.*,userinfo.email,userinfo.realname from login,userinfo where login.uid=userinfo.uid";
if ($_GET['uid']) {
    $sql .= " and login.uid={$_GET['uid']}";
}
$sql .= " order by ltime desc";
$cnt = $p->dosql($sql);
$st = 检测页面($cnt, $_GET['page']);
?>
<div class='row-fluid'>
<table class='table table-striped table-condensed table-bordered fiexd'>
<thead><tr>
<th width=40px>编号</th>
Example #7
0
if ($pid) {
    $p = new DataAccess();
    $sql = "select * from problem where pid={$pid}";
    $cnt = $p->dosql($sql);
    $d = $p->rtnrlt(0);
    if (!有此权限("修改题目") && $uid != $d['addid']) {
        异常("没有修改权限!", 取路径("problem/index.php"));
    }
}
if ($_GET[action] == "change") {
    if (有此权限("修改题目") && 有此权限("查看题目")) {
        $sql = "update problem set submitable=1-submitable where pid={$pid}";
        $p->dosql($sql);
        提示("修改可用与否成功!", 取路径("problem/index.php?order=asc&rank=submitable"));
    } else {
        异常("没有权限修改或查看题目!", 取路径("problem/index.php?order=asc&rank=submitable"));
    }
}
if ($_FILES['datafile']['size'] && !$_FILES['datafile']['error']) {
    //chdir($cfg['testdata']);
    chdir("/tmp");
    //$dir="{$cfg['testdata']}/{$filename}/";
    $dir = "/tmp/{$filename}/";
    mkdir($dir);
    //$cmd = "unzip -uo {$_FILES['datafile']['tmp_name']} -d\"{$cfg['testdata']}\"";
    $cmd = "unzip -uo {$_FILES['datafile']['tmp_name']} -d\"/tmp\"";
    exec($cmd);
    exec("chmod 755 *");
    $ff = "<p>正在重命名测试数据:</p>";
    chdir($dir);
    $pname = $filename;
Example #8
0
<?php

require_once "../include/header.php";
gethead(1, "查看比赛", "比赛场次评测");
$p = new DataAccess();
$q = new DataAccess();
$sql = "select comptime.*,compbase.cname,groups.* from comptime,compbase,groups where comptime.cbid=compbase.cbid and comptime.ctid={$_GET[ctid]} and groups.gid=comptime.group";
$cnt = $p->dosql($sql);
if (!$cnt) {
    异常("未查询到记录!");
}
$d = $p->rtnrlt(0);
?>
<div class='row-fluid'>
<table class='table table-striped table-condensed table-bordered fiexd'>
  <tr>
    <td width="90px">CTID</td>
    <td><?php 
echo $d[ctid];
?>
</td>
    <td width="90px">关联比赛</td>
    <td><?php 
echo $d[cname];
?>
</td>
  </tr>
  <tr>
    <td>开始时间</td>
    <td><?php 
echo date('Y-m-d H:i:s', $d[starttime]);
Example #9
0
    if ($cnt) {
        $e = $p->rtnrlt(0);
    } else {
        异常("无此题目!", 取路径("problem/commentlist.php"));
    }
} else {
    if ($aid) {
        $sql = "select title from page where aid={$aid} limit 1";
        $cnt = $p->dosql($sql);
        if ($cnt) {
            $e = $p->rtnrlt(0);
        } else {
            异常("无此页面!", 取路径("page/index.php"));
        }
    } else {
        异常("什么也没找到!");
    }
}
?>
<div class='container-fluid'>
<form method="post" action="sendcomments.php" class='form-horizontal' id="tijiao">
<div class='modal-header'>
<h3><?php 
echo $cid ? "修改" : "发表";
?>
 
<?php 
if ($pid) {
    ?>
<a href="problem.php?pid=<?php 
    echo $pid;
Example #10
0
require_once "../include/header.php";
gethead(8, "修改页面", "");
过滤();
//date_default_timezone_set("Asia/Shanghai");
if ($_REQUEST[action] == 'add') {
    $p = new DataAccess();
    $sql = "insert into page(title,`force`,`text`,`time`,etime,uid,`group`) values('{$_POST[title]}','{$_POST[force]}','" . $_POST[text] . "','" . time() . "','" . time() . "','{$_SESSION[ID]}','{$_POST['group']}')";
    $p->dosql($sql);
    $d = $p->rtnrlt(0);
    $aid = $d['aid'];
    提示("新建页面 {$_POST[title]} 成功", 取路径("page/page.php?aid={$aid}"));
} else {
    if ($_REQUEST[action] == 'edit') {
        $p = new DataAccess();
        $sql = "update page set title='{$_POST[title]}',`force`={$_POST[force]}, etime=" . time() . ",`text`='" . $_POST[text] . "',`group`='{$_POST['group']}' where aid={$_REQUEST[aid]}";
        $p->dosql($sql);
        $aid = $_REQUEST[aid];
        提示("修改页面 {$_POST[title]} 成功", 取路径("page/page.php?aid={$aid}"));
    } else {
        if ($_REQUEST[action] == 'del') {
            $p = new DataAccess();
            $sql = "delete from page where aid={$_REQUEST[aid]}";
            $p->dosql($sql);
            $aid = 0;
            异常("删除页面 {$_REQUEST[aid]} 成功", 取路径("page/index.php"));
        }
    }
}
?>

Example #11
0
<?php

require_once "../include/header.php";
gethead(1, "", "用户注册");
if (!$SET['limit_regallow']) {
    异常("暂时不允许注册!");
}
if ($_SESSION['ID']) {
    异常("已经登录!");
}
?>
<div class='container'>
<?php 
if ($_GET[accept] == 1) {
    ?>
<form id='zhuce' method="post" action="doreg.php" class='form-inline'>
<table class='table-form'>
<tr>
<th width='100px'>用户名称</th>
<td><input name="usr" type="text" id="usr" /> 1~24位,遵循变量名命名规范</td>
</tr>
<tr>
<th>密码</th>
<td><input name="pwd" type="password" id="pwd"> 0~24位,加密存储</td>
</tr>
<tr>
<th>重复密码</th>
<td><input name="repwd" type="password" id="repwd" /> 验证你没有输错</td>
</tr>
<tr>
<th>用户昵称</th>
Example #12
0
    }
    $subgroup = $LIB->getsubgroup($q, $d['gid']);
    $subgroup[0] = $d['gid'];
    $promise = false;
    foreach ($subgroup as $value) {
        if ($value == (int) $_SESSION['group']) {
            $promise = true;
            break;
        }
    }
    if (!$promise && !有此权限('查看页面')) {
        exit;
    }
    $aid = $d[aid];
} else {
    异常("页面不存在!", 取路径("page/index.php"));
}
?>

<div class='row-fluid'>
<div class='page'>
<div class="problem tou">
<h1><?php 
echo $d['title'];
if (有此权限('修改页面')) {
    ?>
<a href="editpage.php?action=edit&aid=<?php 
    echo $d['aid'];
    ?>
" title="修改页面 <?php 
    echo $d['title'];
Example #13
0
gethead(8, "sess", "");
$p = new DataAccess();
$scd = (int) $_POST['showcode'];
$uid = (int) $_SESSION['ID'];
$pid = (int) $_POST['pid'];
$aid = (int) $_POST['aid'];
$cid = (int) $_POST['cid'];
$detail = mysql_real_escape_string($_POST['detail']);
$showcode = (int) $_POST['showcode'];
$tm = time();
if ($cid) {
    $sql = "update comments set detail='{$detail}', stime={$tm} ,showcode={$showcode} where cid={$cid}";
} else {
    if ($pid) {
        $sql = "insert into comments(pid,uid,detail,stime,showcode) values({$pid},{$uid},'{$detail}',{$tm} ,{$showcode})";
    } else {
        if ($aid) {
            $sql = "insert into comments(aid,uid,detail,stime,showcode) values({$aid},{$uid},'{$detail}',{$tm} ,{$showcode})";
        } else {
            异常("发表评论失败!", 取路径("problem/comments.php"));
        }
    }
}
$cnt = $p->dosql($sql);
if ($pid) {
    提示("发表评论成功!", 取路径("problem/comments.php?pid={$pid}"));
} else {
    if ($aid) {
        提示("发表评论成功!", 取路径("problem/comments.php?aid={$aid}"));
    }
}
Example #14
0
<?php

require_once "../include/header.php";
gethead(8, "sess", "");
$p = new DataAccess();
$_POST['fromid'] = (int) $_POST['fromid'];
$_POST['toid'] = (int) $_POST['toid'];
if (!$_POST['fromid']) {
    异常("发件人错误!", 取路径("mail/index.php"));
}
if (!$_POST['toid']) {
    异常("收件人错误!", 取路径("mail/index.php"));
}
if (!$_POST['title']) {
    异常("标题错误!", 取路径("mail/index.php"));
}
if (!$_POST['msg']) {
    异常("信件内容错误!", 取路径("mail/index.php"));
}
$sql = "insert into mail(mid, fromid, toid, time, readed, title, msg) values(0, {$_POST['fromid']}, {$_POST['toid']}, " . time() . ", 0, '{$_POST['title']}', '{$_POST['msg']}')";
$p->dosql($sql);
// or die(mysql_error());
提示("发送邮件成功!", 取路径("mail/index.php"));
Example #15
0
    $p = new DataAccess();
    $sql = "update grader set address='{$_POST['address']}',priority='{$_POST['priority']}',enabled='{$enabled}',memo='{$_POST['memo']}' where grid={$_REQUEST[grid]}";
    $p->dosql($sql);
    提示("修改评测机 {$_POST['address']} 成功!", 取路径("submit/graderlist.php"));
}
if ($_REQUEST['action'] == 'start') {
    $p = new DataAccess();
    $sql = "select address from grader where grid={$_GET[grid]}";
    $cnt = $p->dosql($sql);
    $d = $p->rtnrlt(0);
    $s['action'] = "start";
    httpsocket($d['address'], $s);
    if ($s['state'] == "successful") {
        提示("启动评测机 {$_GET[grid]} 成功!", 取路径("submit/graderlist.php"));
    } else {
        异常("启动评测机 {$_GET[grid]} 失败!", 取路径("submit/graderlist.php"));
    }
}
if ($_REQUEST['action'] == 'stop') {
    $p = new DataAccess();
    $sql = "select address from grader where grid={$_GET[grid]}";
    $cnt = $p->dosql($sql);
    $d = $p->rtnrlt(0);
    $s['action'] = "shutdown";
    httpsocket($d['address'], $s);
    if ($s['state'] == "successful") {
        提示("关闭评测机 {$_GET[grid]} 成功!", 取路径("submit/graderlist.php"));
    } else {
        异常("关闭评测机 {$_GET[grid]} 失败!", 取路径("submit/graderlist.php"));
    }
}
Example #16
0
if (!file_exists($_SESSION[ID])) {
    mkdir($_SESSION[ID]);
    chmod($_SESSION[ID], 0775);
}
chdir($_SESSION[ID]);
if (file_exists($fname)) {
    unlink($fname);
}
move_uploaded_file($_FILES['file']['tmp_name'], $fname);
chmod($fname, 0775);
if (!file_exists($fname)) {
    异常("比赛提交代码文件 {$fname} 失败!", 取路径("contest/problem.php?pid={$_POST['pid']}&ctid={$_POST['ctid']}"));
}
$p = new DataAccess();
$sql = "select csid from compscore where uid={$_SESSION[ID]} and pid={$_POST[pid]} and ctid={$_POST[ctid]}";
$cnt = $p->dosql($sql);
if ($cnt) {
    $sql = "update compscore set subtime=" . time() . ",lang={$nlang} where ctid={$_POST[ctid]} and uid={$_SESSION[ID]} and pid={$_POST[pid]}";
    $p->dosql($sql);
} else {
    $sql = "insert into compscore(ctid,uid,pid,subtime,lang) values({$_POST[ctid]},{$_SESSION[ID]},{$_POST[pid]}," . time() . ",{$nlang})";
    $p->dosql($sql);
}
$sql = "select csid from compscore where uid={$_SESSION[ID]} and pid={$_POST[pid]} and ctid={$_POST[ctid]}";
$cnt = $p->dosql($sql);
if ($cnt) {
    $d = $p->rtnrlt(0);
    提示("比赛提交代码成功!", 取路径("contest/code.php?csid={$d['csid']}"));
} else {
    异常("比赛提交代码失败!", 取路径("contest/problem.php?pid={$_POST['pid']}&ctid={$_POST['ctid']}"));
}
Example #17
0
<?php

require_once "../include/header.php";
$p = new DataAccess();
$uid = (int) $_GET['uid'];
$user = $_GET['user'];
if ($uid) {
    $sql = "select userinfo.*,groups.gname,groups.gid from userinfo,groups where userinfo.uid={$uid} and userinfo.gbelong=groups.gid";
} else {
    $sql = "select userinfo.*,groups.gname,groups.gid from userinfo,groups where (userinfo.uid='{$user}' OR userinfo.nickname='{$user}' OR userinfo.realname='{$user}' OR userinfo.usr='******') and userinfo.gbelong=groups.gid";
}
$cnt = $p->dosql($sql);
if (!$cnt) {
    异常("无此用户!", 取路径("user/index.php"));
}
$d = $p->rtnrlt(0);
$uid = $d['uid'];
gethead(1, "", "{$d['nickname']}", $uid);
$q = new DataAccess();
?>
<div class='row-fluid'>
<div class='span4'>
<table class='table table-striped table-condensed table-bordered fiexd'>
<tr>
<th style="width: 5em;">用户编号</th>
<td><?php 
echo $d['uid'];
?>
</td>
</tr>
<tr>
Example #18
0
    if (!preg_match('/(\\S{1,20})/', $_POST['nickname'])) {
        异常("昵称长度必须在[2,20]中。", $regpage);
    }
    if (!preg_match('/(\\S*@\\S*\\.\\S*)/', $_POST['email'])) {
        异常("电子邮箱格式不正确。", $regpage);
    }
    if (!preg_match('/(\\S{0,8})/', $_POST['realname'])) {
        异常("真实姓名长度必须在[0,8]中,应该是汉字。", $regpage);
    }
    if (!preg_match('/(.{0,64})/', $_POST['passwordtip'])) {
        异常("提示问题长度必须在[0,64]中。", $regpage);
    }
    if (!preg_match('/(.{0,64})/', $_POST['passwordtipans'])) {
        异常("提示问题答案长度必须在[0,64]中。", $regpage);
    }
    $sql = "insert into userinfo(uid,usr,nickname,readforce,admin,regtime,pwdhash,pwdtipques,pwdtipanshash,memo,realname,email,gbelong,user_style,style) values (0, '{$_POST[usr]}','{$_POST[nickname]}','{$SET['reg_readforce']}',0, " . time() . ",'" . encode($_POST[pwd]) . "' ,'{$_POST[passwordtip]}' , '" . encode($_POST[passwordtipans]) . "', '{$_POST[memo]}','{$_POST['realname']}','{$_POST['email']}','{$SET['reg_defgroup']}','{$SET['user_style']}', 0)";
    $p->dosql($sql);
    $sql = "select * from userinfo where usr='******'usr'] . "'";
    $cnt2 = $p->dosql($sql);
    if ($cnt2 == 1) {
        $d = $p->rtnrlt(0);
    } else {
        异常("用户 {$_POST['usr']} 注册失败!", 取路径("user/register.php?accept=1"));
    }
    $tm = time() + 7776000;
    setcookie("cogs_usr", $_POST[usr], $tm, "/");
    setcookie("cogs_pwd_hash", encode($_POST[pwd]), $tm, "/");
    提示("用户 {$_POST['usr']} 注册成功!生成头像缓存需要一定时间等耐心等待……<p>之后你可以更改你的个人信息看看。", 取路径("user/panel.php"));
} else {
    异常("用户 {$_POST['usr']} 已存在!", 取路径("user/register.php?accept=1"));
}
Example #19
0
function gethead($head, $check, $title, $userid = 0)
{
    global $SET, $cfg, $LIB;
    $user_style = $_SESSION['user_style'] ? $_SESSION['user_style'] : $SET["user_style"];
    if ($head > 0) {
        ?>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<!--<meta name="author" content="CmYkRgB123, BYVoid; 王者自由, Kingfree" />
<meta name="description" content="CmYkRgB123 Online Grading System,简称 COGS ,又称 COJS。是一款 OI 在线评测系统,基于 LAMP 技术,文件输入输出,支持评测插件和提交答案。" />
<meta name="keywords" content="COGS, COJS, OJ, OI, NOI, ACM/ICPC" />
<meta name="generator" content="Vim" />
<meta name="revised" content="<?php 
        echo $cfg['Version'];
        ?>
" />
<meta name="others" content="" />-->

<link rel="Shortcut Icon" href="<?php 
        echo 路径("style/cogs.png");
        ?>
" />
<link rel=stylesheet type="text/css" href="/Bootstrap/css/<?php 
        echo $user_style;
        ?>
.min.css" />
<link rel=stylesheet href="<?php 
        echo 路径("style/{$SET['style_profile']}");
        ?>
" />
<?php 
        背景图片($userid ? $userid : $_SESSION['ID']);
        $LIB->tradsimp();
        ?>
<script type="text/javascript" src="/jQuery/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<?php 
        echo 路径("include/sortTable.js");
        ?>
"></script>
<script type="text/javascript" src="/Bootstrap/js/bootstrap.min.js"></script>
<!--[if IE 6]>
<link href="/Bootstrap-IE6/ie6.min.css" type="text/css" rel="stylesheet">
<![endif]-->
<title><?php 
        echo $title . " - " . $SET['global_sitename'];
        ?>
</title>
</head>
<body>
<div id="alltext">
<?php 
        if ($check == "sess") {
            $check = "普通用户";
        } else {
            if ($check == "admin") {
                $check = "管理用户";
            } else {
                if ($check == "advadmin") {
                    $check = "超级用户";
                }
            }
        }
        if (!有此权限($check)) {
            异常("没有权限 {$check} !");
        }
        $pi = new DataAccess();
        require_once 路径("include/navigation.php");
        if ($head != 8) {
            if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') == false) {
                Navigation($pi);
            } else {
                Navigation_IE($pi);
            }
        }
        ?>

<div id="body" class='container-fluid'>
<?php 
    }
}
Example #20
0
if ($_GET['pid']) {
    $sql .= " and submit.pid={$_GET['pid']} ";
}
$sql .= " order by submit.sid desc";
$limitt = (int) $SET['style_pagesize'] / 2;
if (!$_GET['show'] && !$_GET['pid']) {
    $sql .= " limit {$limitt}";
}
$cnt = $p->dosql($sql);
$totalpage = (int) (($cnt - 1) / $SET['style_pagesize']) + 1;
if (!$_GET['page']) {
    $_GET['page'] = 1;
    $st = 0;
} else {
    if ($_GET[page] < 1 || $_GET[page] > $totalpage) {
        异常("页面错误!");
    } else {
        $st = ($_GET[page] - 1) * $SET['style_pagesize'];
    }
}
?>
<table id="submitlist" class='table table-striped table-condensed table-bordered fiexd'>
<thead><tr>
<th style="min-width: 6ex;">SID</th>
<th>题目</th>
<th>用户</th>
<th style="min-width: 20ex;">结果</th>
<th style="min-width: 5ex;">得分</th>
<th style="min-width: 6ex;">语言</th>
<th style="min-width: 10ex;">用时</th>
<th style="min-width: 10ex;">内存</th>
Example #21
0
            } else {
                异常("旧密码不正确!", 取路径("user/panel.php"));
            }
        } else {
            异常("两次输入的密码不匹配!", 取路径("user/panel.php"));
        }
    } else {
        if ($_POST[action] == "editpwdans") {
            $p = new DataAccess();
            $sql = "select pwdhash,nickname from userinfo where uid={$_GET[uid]}";
            $p->dosql($sql);
            $d = $p->rtnrlt(0);
            $uid = (int) $_GET['uid'];
            if ($d['pwdhash'] == encode($_POST['opwd'])) {
                if (!preg_match('/(.{0,64})/', $_POST['passwordtip'])) {
                    异常("提示问题长度必须在[0,64]中。", $regpage);
                }
                if (!preg_match('/(.{0,64})/', $_POST['passwordtipans'])) {
                    异常("提示问题答案长度必须在[0,64]中。", $regpage);
                }
                $que = htmlspecialchars($_POST['qus']);
                $ans = encode($_POST['ans']);
                $sql = "update userinfo set pwdtipques='{$que}',pwdtipanshash='{$ans}' where uid={$uid}";
                $p->dosql($sql);
                提示("用户 {$nickname} 的密码提示问题修改成功!", 取路径("user/panel.php"));
            } else {
                异常("旧密码不正确!", 取路径("user/panel.php"));
            }
        }
    }
}
Example #22
0
<?php

require_once "../include/header.php";
gethead(8, "sess", "");
过滤();
$p = new DataAccess();
if (!$_POST['pid']) {
    异常("没有选择题目!", 取路径("problem/index.php"));
}
if (!$_POST['title']) {
    异常("没有填写题解名称!", 取路径("problem/problem.php?pid={$_POST['pid']}"));
}
$sql = "select * from solution where `link`='' limit 1";
$cnt = $p->dosql($sql);
if (!$cnt) {
    $sql1 = "insert into category(cname,memo) values('{$_POST['cname']}','{$_POST['memo']}')";
    $p->dosql($sql1);
} else {
    提示("添加题目 {$_POST['pid']} 分类 “{$e['caid']}. {$_POST['cname']}” 成功,虽然它之前就已经存在了!", 取路径("problem/problem.php?pid={$_POST['pid']}"));
}
Example #23
0
if (!$_POST['pid']) {
    异常("没有选择题目!", 取路径("problem/index.php"));
}
if (!$_POST['cname']) {
    异常("没有填写分类名!", 取路径("problem/problem.php?pid={$_POST['pid']}"));
}
$sql = "select * from category where cname like '%{$_POST['cname']}%' or memo like '%{$_POST['cname']}%' limit 1";
$cnt = $p->dosql($sql);
if (!$cnt) {
    $sql1 = "insert into category(cname,memo) values('{$_POST['cname']}','{$_POST['memo']}')";
    $p->dosql($sql1);
} else {
    $e = $p->rtnrlt(0);
    $st = trim("{$e['memo']} {$_POST['memo']}");
    $sql1 = "update category set memo='{$st}' where caid={$e['caid']}";
    $p->dosql($sql1);
    $sql2 = "select * from tag where pid={$_POST['pid']} and caid={$e['caid']}";
    $al = $p->dosql($sql2);
    if ($al) {
        提示("添加题目 {$_POST['pid']} 分类 “{$e['caid']}. {$_POST['cname']}” 成功,虽然它之前就已经存在了!", 取路径("problem/problem.php?pid={$_POST['pid']}"));
        exit(0);
    }
}
$cnt = $p->dosql($sql);
if (!$cnt) {
    异常("添加分类失败!", 取路径("problem/problem.php?pid={$_POST['pid']}"));
}
$e = $p->rtnrlt(0);
$sql2 = "insert into tag(pid,caid) values({$_POST['pid']},{$e['caid']})";
$p->dosql($sql2);
提示("添加题目 {$_POST['pid']} 分类 “{$e['caid']}. {$_POST['cname']}” 成功!", 取路径("problem/problem.php?pid={$_POST['pid']}"));
Example #24
0
            $d = $p->rtnrlt(0);
            echo "{$d[pwdtipques]}?";
            ?>
</span></p>
<p>上面问题的答案
<input name="ans" type="text" id="ans" />
</p>
<p>
<button type="submit" class='btn'>下一步</button>
<input name="User" type="hidden" id="User" value="<?php 
            echo $_POST['User'];
            ?>
" />
</p>
</form>
<?php 
        }
    } else {
        $sql = "select pwdtipanshash from userinfo where usr='******'User'] . "'";
        $p->dosql($sql);
        $d = $p->rtnrlt(0);
        if ($d[pwdtipanshash] == encode($_POST[ans])) {
            $sql = "update userinfo set pwdhash='" . encode("") . "' where usr='******'User'] . "'";
            $p->dosql($sql);
            提示("密码已经被清空,请立刻登录并修改密码!");
        } else {
            异常("密码提示问题的答案不正确!", 取路径("user/lost.php"));
        }
    }
}
include_once "../include/footer.php";
Example #25
0
File: run.php Project: Zhi2014/cogs
正在连接评测机...
<?php 
flush();
$free = $Cp->getgds($_POST['judger']);
if (!$free) {
    //$Cp->unlock();
    异常("当前没有空闲的评测机,请稍后重新提交。", 取路径("problem/problem.php?pid={$_POST['pid']}"));
}
$Cp->lock();
$Cp->getdir();
if ($_POST['rejudge'] == 1) {
    $Cp->get_rejudge_src($src);
} else {
    if (!$Cp->getupload()) {
        $Cp->unlock();
        异常("源代码上传失败。请检查文件大小。", 取路径("problem/problem.php?pid={$_POST['pid']}"));
    }
}
?>
<span class='badge badge-info'><?php 
echo $Cp->state['grid'];
?>
</span>
<span class='label label-info'><?php 
echo $Cp->state['name'];
?>
 <?php 
echo $Cp->state['ver'];
?>
</span>
<?php 
Example #26
0
    $promise = false;
    if ($uid == $d['addid']) {
        $promise = true;
    }
    foreach ($subgroup as $value) {
        if ($value == (int) $_SESSION['group']) {
            $promise = true;
            break;
        }
    }
    if (!$promise && !有此权限('查看题目')) {
        异常("没有阅读权限!", 取路径("problem/index.php"));
    }
    $pid = $d[pid];
} else {
    异常("无此题目!!", 取路径("problem/index.php"));
}
?>

<div class='row-fluid'>
<div id="leftbar" class='span4'>
<table class='table table-striped table-condensed table-bordered fiexd'>
<tr><th style="min-width: 5em;">题目名称</th>
<td style="min-width: 80%;"><?php 
echo $d['pid'];
?>
. <b><?php 
echo $d['probname'];
?>
</b></td></tr>
<tr><th>输入输出</th>
Example #27
0
function i异常($msg = "错误", $id = "", $jp = 0)
{
    gethead(8, "", "");
    global $SET;
    if (!$jp) {
        $jp = $SET['style_jumptime'];
    }
    异常($msg, $id, $jp);
}