function Navigation_IE($p) { global $SET; $navbar = ""; if ($_SESSION['style']) { $navbar = "navbar-inverse"; } HTML("<div id='nav' class='navbar {$navbar}'>"); HTML("<div class='navbar-inner'>"); HTML("<div class='container-fluid'>"); HTML("<a href='" . 路径("index.php") . "' class='brand'>COGS</a>"); HTML("<a class='btn btn-navbar' data-toggle='collapse' data-target='.nav-collapse'><span class='icon-bar'></span><span class='icon-bar'></span><span class='icon-bar'></span></a>"); HTML("<div class='nav-collapse'>"); HTML("<ul class='nav'>"); if (strpos($SET['cur'], "comment")) { $active['comment'] = 'active'; } else { if (strpos($SET['cur'], "contest")) { $active['contest'] = 'active'; } else { if (strpos($SET['cur'], "problem")) { $active['problem'] = 'active'; } else { if (strpos($SET['cur'], "submit")) { $active['submit'] = 'active'; } else { if (strpos($SET['cur'], "page")) { $active['page'] = 'active'; } else { if (strpos($SET['cur'], "user")) { $active['user'] = '******'; } else { if (strpos($SET['cur'], "docs")) { $active['docs'] = 'active'; } else { if (strpos($SET['cur'], "admin")) { $active['admin'] = 'active'; } } } } } } } } HTML("<li class='{$active['problem']}'><a href='" . 路径("problem/index.php") . "'>题目</a></li>"); HTML("<li class='{$active['submit']}'><a href='" . 路径("submit/index.php") . "'>记录</a></li>"); $context = "比赛"; $now = time(); $cnt2 = $p->dosql("select ctid from comptime where starttime < {$now} and endtime > {$now}"); if ($cnt2) { $context .= "<span class='doing'>({$cnt2})</span>"; } $cnt1 = $p->dosql("select ctid from comptime where starttime > {$now} and endtime > {$now}"); if ($cnt1) { $context .= "<span class='todo'>({$cnt1})</span>"; } HTML("<li class='{$active['contest']}'><a href='" . 路径("contest/index.php") . "'>{$context}</a></li>"); HTML("<li class='{$active['page']}'><a href='" . 路径("page/index.php") . "'>页面</a></li>"); HTML("<li class='{$active['user']}'><a href='" . 路径("user/index.php") . "'>用户</a></li>"); HTML("<li class='{$active['comment']}'><a href='" . 路径("problem/comments.php") . "'>评论</a></li>"); HTML("</ul>"); HTML("<ul class='nav pull-right'>"); HTML("<li class='{$active['docs']}'><a href='" . 路径("docs/index.php") . "'>帮助</a></li>"); if (有此权限('可以管理')) { HTML("<li class='{$active['admin']}'><a href='" . 路径("admin/index.php") . "'>管理</a></li>"); } HTML("<li class='divider-vertical'></li>"); HTML("<li class='dropdown'>"); if ($uid = (int) $_SESSION['ID']) { $sql = "select * from userinfo where uid='{$uid}'"; $p->dosql($sql); $d = $p->rtnrlt(0); $nickname = $d['nickname']; $cnt1 = $p->dosql("select mid from mail where readed = 0 and toid = {$uid}"); if ($cnt1 > 0) { $mails .= "<span class='doing'>({$cnt1})</span>"; } $cnt1 = $p->dosql("select mid from mail where readed = 0 and fromid = {$uid}"); if ($cnt1 > 0) { $mails .= "<span class='todo'>({$cnt1})</span>"; } } else { $nickname = "登录"; } if ($uid = (int) $_SESSION['ID']) { HTML("<li class=''><a href='" . 路径("user/detail.php?uid={$uid}") . "'>{$nickname}{$mails}</a></li>"); //HTML("<li class=''><a href='".路径("user/panel.php")."'>设置</a></li>"); //HTML("<li class=''><a href='".路径("mail/index.php")."'>信件{$mails}</a></li>"); HTML("<li class=''><a href='" . 路径("user/dologout.php") . "'>退出</a></li>"); } else { HTML("<li class=''><a href='" . 路径("user/login.php") . "'>登录</a></li>"); HTML("<li class=''><a href='" . 路径("user/register.php") . "'>注册</a></li>"); } HTML("</ul>"); HTML("</li>"); HTML("</ul>"); HTML("</div>"); HTML("</div>"); HTML("</div>"); HTML("</div>"); }
<?php require_once "../include/header.php"; gethead(8, "普通用户", ""); if (!有此权限("查看比赛") && time() > $_POST['endtime']) { 异常("比赛已经结束,不可再提交!", 取路径("contest/problem.php?pid={$_POST['pid']}&ctid={$_POST['ctid']}")); } if ($_FILES['file']['size'] > 1024 * 100 || $_FILES['file']['size'] <= 0) { 异常("源代码上传失败。请检查文件大小。", 取路径("contest/problem.php?pid={$_POST['pid']}&ctid={$_POST['ctid']}")); } $fname = $_POST[filename]; switch ($_POST[lang]) { case 'pas': $fname .= ".pas"; $nlang = 0; break; case 'c': $fname .= ".c"; $nlang = 1; break; case 'cpp': $fname .= ".cpp"; $nlang = 2; break; case 'zip': $fname .= ".zip"; $nlang = 3; break; } chdir($SET['dir_competition']); if (!file_exists($_POST[ctid])) {
</div> </div> </div> <div class='span6'> <div class='control-group'> <label class='control-label' for='difficulty'>难度等级</label> <div class='controls'> <input name="difficulty" type="number" id="difficulty" value="<?php echo $d['difficulty']; ?> " class='span4' /> </div> </div> <div class='control-group'> <?php if (有此权限("查看题目")) { ?> <label class='control-label' for='readforce'>阅读权限</label> <div class='controls'> <input name="readforce" type="number" id="readforce" value="<?php echo $d['readforce']; ?> " class='span4' /> <span class='help-inline'><label class='checkbox inline'> <input name="submitable" type="checkbox" id="submitable" value="1" <?php if ($d['submitable']) { echo 'checked="checked"'; } ?> /> 可否提交</label></span>
echo $d['uid']; ?> /> <input name="title" type="hidden" value="申请加入:<?php echo $d['gname']; ?> " /> <input name="text" type="hidden" value="请输入你的加入原因,或你的个人信息,以通过组管理员的验证。" /> <button type="submit" class='btn btn-mini'>申请</button> </form> </td> <?php } ?> <?php if (有此权限('分组管理')) { ?> <td><a href="editgroup.php?action=edit&gid=<?php echo $d['gid']; ?> ">修改</a></td> <?php } ?> </tr> <?php } ?> </table> </div> <?php
echo $d['realname']; } else { echo $d['nickname']; } ?> </a></td> <?php if (有此权限('查看比赛')) { ?> <td><a href="comptime.php?ctid=<?php echo $d['ctid']; ?> ">评测</a></td> <?php } if (有此权限('修改比赛')) { ?> <td><a href="editcompbase.php?action=edit&cbid=<?php echo $d['cbid']; ?> "><?php echo $d['cbid']; ?> </a></td> <td><a href="editcomptime.php?action=edit&ctid=<?php echo $d['ctid']; ?> "><?php echo $d['ctid']; ?> </a></td>
<?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>
} $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' && 有此权限('测试题目')) { $info['mode'] = "test"; } if ($_POST['rejudge'] == 1) { $info['rejudge'] = 1; $sql = "select * from submit where sid='{$info['sid']}'"; $p->dosql($sql); $e = $p->rtnrlt(0); $info['uid'] = $e['uid']; $src = $e['srcname']; } ?> <script language="javascript"> </script>
</tr> <?php } ?> </table> <?php } ?> </div> <div class='span8'> <a href="../submit/index.php?uid=<?php echo $uid; ?> " target="_blank">查看全部提交记录</a> <?php if (有此权限('查看用户') || $_SESSION['ID'] == $uid) { ?> <a href="export.php?uid=<?php echo $uid; ?> " target="_blank" class='btn pull-right'>导出全部提交记录</a> <?php } $accnt = 0; $sql = "select problem.pid,problem.probname,submit.accepted,submit.lang,submit.sid from submit,problem where submit.uid={$uid} and submit.pid=problem.pid order by problem.pid asc, submit.score desc "; $cnt = $p->dosql($sql); if ($cnt) { ?> <table class='table table-striped table-condensed table-bordered fiexd'> <?php $ppp = array();
echo sp2n(htmlspecialchars($d['memo'])); ?> </td> <td><a href='<?php echo $d['address']; ?> ' target='_blank'><?php echo $d['address']; ?> </a></td> <td><?php echo $d['priority']; ?> </td> <?php if (有此权限('管理评测')) { ?> <td> <a href="editgrader.php?action=edit&grid=<?php echo $d['grid']; ?> ">修改</a> <a href="doeditgrader.php?action=start&grid=<?php echo $d['grid']; ?> ">启动</a> <a href="doeditgrader.php?action=stop&grid=<?php echo $d['grid']; ?> ">关闭</a> </td>
echo $sql; $p->dosql($sql); $sql = "select pid from problem where filename='{$filename}'"; $p->dosql($sql); $d = $p->rtnrlt(0); $pid = $d['pid']; foreach ($_POST[cate] as $k => $v) { if ($v) { $sql = "insert into tag(pid,caid) values({$pid},{$k})"; $p->dosql($sql); } } 提示("{$ff} 添加题目 {$pid} 成功!", 取路径("problem/problem.php?pid={$pid}"), 60); } else { if ($_REQUEST[action] == 'edit') { if (!有此权限("查看题目")) { $sub = $rf = 0; } $p = new DataAccess(); $sql = "select filename from problem where pid={$_REQUEST['pid']}"; $cnt = $p->dosql($sql); if ($cnt) { $d = $p->rtnrlt(0); if ($d['filename'] != $filename) { $sql = "update problem set addtime=" . time() . ", addid=" . (int) $_SESSION['ID'] . " where pid={$_REQUEST['pid']}"; $p->dosql($sql); } } $sql = "update problem set probname='{$_POST['probname']}',filename='{$_POST[filename]}',readforce={$rf},submitable={$sub},datacnt={$_POST[datacnt]},timelimit={$_POST[timelimit]},memorylimit={$_POST[memorylimit]},detail='" . $_POST['detail'] . "',difficulty={$_POST[difficulty]},plugin='{$_POST['plugin']}',`group`='{$_POST['group']}' where pid={$_REQUEST['pid']}"; $p->dosql($sql); foreach ($_POST[cate] as $k => $v) {
echo $d['timelimit'] / 1000; ?> s 内存限制:<?php echo $d['memorylimit']; ?> MB </div> <dl class='problem'> <?php echo $d['detail']; ?> </dl> <?php if (有此权限('查看比赛') || $_SESSION['ID'] && time() < $e['endtime'] && time() > $e['starttime']) { ?> <form action="submit.php" method="post" enctype="multipart/form-data" class='form-inline' id="tijiao"> <td colspan=2> <input id="source" type="file" name="file" title='选择程序源文件' /> <?php if ($d['plugin'] == 3 || $d['plugin'] == 4) { ?> <input type='hidden' name='lang' value='zip' /> 请提交一个 zip 压缩包,里面<b>直接</b>有 <?php echo $d['datacnt']; ?> 个 <?php echo $d['filename']; ?> #.out 文件
printf("%.2f", $d['memory'] / 1024); ?> MiB </td> <th>IP</th> <td><?php if (有此权限('查看用户')) { echo $d['IP']; } ?> </td> </tr> <tr> </tr> </table> <?php if (有此权限('查看代码') || $d['uid'] == $uid) { $forcetocode = 1; } else { $sql = "select showcode from comments where uid={$d['uid']} and pid={$d['pid']} order by showcode desc limit 1"; $cnt = $p->dosql($sql); if ($cnt) { $f = $p->rtnrlt(0); $forcetocode = $f['showcode']; } if (!$forcetocode) { $sql = "select accepted from submit where uid={$uid} and pid={$d['pid']} order by score desc limit 1"; $cnt = $p->dosql($sql); if ($cnt) { $f = $p->rtnrlt(0); $forcetocode = $f['accepted']; }
$d = $p->rtnrlt($i); ?> <tr> <td><?php echo $d['caid']; ?> </td> <td><a href="index.php?caid=<?php echo $d['caid']; ?> "><?php echo $d['cname']; ?> </a></td> <?php if (有此权限('修改分类')) { ?> <td><a href="editcate.php?action=edit&caid=<?php echo $d['caid']; ?> ">修改</a></td><?php } ?> <td><?php echo sp2n(htmlspecialchars($d['memo'])); ?> </td> </tr> <?php } ?>
echo $d['lastip']; ?> </a> </td><?php } ?> <?php if (有此权限('修改用户')) { ?> <td> <a href="edituser.php?uid=<?php echo $d['uid']; ?> " title="修改用户信息"><i class="icon icon-wrench"></i></a> <?php if (有此权限('修改权限')) { ?> <a href='privilege.php?way=edit&uid=<?php echo $d['uid']; ?> ' title="赋予权限"><i class="icon icon-book"></i></a> <?php } ?> <a href="doedituser.php?uid=<?php echo $d['uid']; ?> &action=del" onclick="return okdel('<?php echo $d['nickname']; ?> ')" title="删除用户账号"><i class="icon icon-remove"></i></a>
<?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); ?>
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 } }
echo "<a href='../problem/problem.php?pid={$d['pid']}' target='_blank'><span class='icon-share'></span></a>"; } else { echo "<a href='../problem/problem.php?pid={$d['pid']}' target='_blank'>" . shortname($d['probname']) . "</a>"; } ?> </td> <td><a href='../user/detail.php?uid=<?php echo $d['uid']; ?> ' target='_blank'><?php echo gravatar::showImage($d['email']); ?> </a> <?php echo "<a href='?uid={$d['uid']}&pid={$_GET['pid']}'>"; if (有此权限("查看用户")) { echo $d['realname']; } else { echo $d['nickname']; } echo "</a>"; ?> </td> <td class='wrap'><a href='code.php?id=<?php echo $d['sid']; ?> '><?php echo 评测结果($d['result'], 20); ?> </a></td> <td><span class="<?php
?> 个</span>测试点数据: <input name="filename" type="hidden" value="<?php echo $Cp->filename; ?> " /> <input name="point" type="hidden" value="<?php echo $Cp->wrongpoint; ?> " /> <input name="io" type="submit" value="in" class='btn btn-success'/> <input name="io" type="submit" value="ans" class='btn btn-success'/> </form> <?php } if ($nodata || $_POST['testmode'] && (有此权限('测试题目') || $d['addid'] == $_SESSION['ID'])) { echo "<p class=no>没有写入数据库</p>"; } else { $Cp->writedb_single(); } ?> </div> </div> </div> <?php if ($AC == -1) { ?> <div class='alert'> <p class="no">你在<span class='badge'>第<?php echo $Cp->wrongpoint; ?>
<?php require_once "../include/header.php"; $p = new DataAccess(); $sql = "select compbase.cname,problem.pid,problem.filename,problem.probname,userinfo.uid,userinfo.nickname,userinfo.realname,comptime.endtime,compscore.* from problem,compscore,comptime,compbase,userinfo where compscore.pid=problem.pid and comptime.ctid=compscore.ctid and userinfo.uid=compscore.uid and compscore.csid={$_GET[csid]} and compbase.cbid=comptime.cbid"; $cnt = $p->dosql($sql); if ($cnt) { $d = $p->rtnrlt(0); if (!有此权限("查看比赛") && (time() < $d['endtime'] && $_SESSION['ID'] != $d['uid'])) { 异常("比赛未结束!", 取路径("contest/index.php")); } if ($d[lang] == 0) { $ext = "pas"; } else { 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 { 异常("提交记录不存在"); }
echo $rowcnt; ?> " ><?php if ($end || 有此权限('查看比赛')) { echo $rank[$v][score]; } ?> </td> <?php } ?> <td id="sum<?php echo $rowcnt; ?> " ><?php if ($end || 有此权限('查看比赛')) { echo $sum; } ?> </td> </tr> <?php } ?> </table> </div> <script language="javascript"> var sortsx=true; var rowcnt=<?php echo $rowcnt; ?>
" /> <input id="source" type="file" name="file" title='选择程序源文件' /> <select name='judger' class='input-medium'> <option value=0 selected=selected>自动选择评测机</option> <?php $sql = "select grid,address,memo from grader where enabled=1 order by priority desc"; $cnt = $q->dosql($sql); for ($i = 0; $i < $cnt; $i++) { $e = $q->rtnrlt($i); echo "<option value={$e['grid']} >{$e['memo']}</option>"; } ?> </select> <?php if (有此权限('测试题目') || $d['addid'] == $uid) { ?> <label class='checkbox inline'> <?php if ($d['addid'] == $uid && $d['submitable'] != 1) { $tmm = 1; } else { $tmm = 0; } ?> <input id="testmode" name="testmode" type="checkbox" <?php if ($tmm) { echo "checked"; } ?> value="<?php
?> </td> <td><?php echo $d['acceptcnt']; ?> </td> <td><?php echo $d['submitcnt']; ?> </td> <td><?php echo @round($d['acceptcnt'] / $d['submitcnt'] * 100, 2); ?> %</td> <?php if (有此权限('查看题目')) { ?> <td class="center"> <a href="doeditprob.php?action=change&pid=<?php echo $d['pid']; ?> " title="更改题目 <?php echo shortname($d['probname']); ?> 的可用性" onclick="return okic('<?php echo $d['probname']; ?> ')"> <?php if ($d['submitable']) { echo "<span class='label label-success'><i class='icon icon-ok-circle icon-white'></i></span>";