本文整理汇总了PHP中DataAccess::rtnrlt方法的典型用法代码示例。如果您正苦于以下问题:PHP DataAccess::rtnrlt方法的具体用法?PHP DataAccess::rtnrlt怎么用?PHP DataAccess::rtnrlt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccess
的用法示例。
在下文中一共展示了DataAccess::rtnrlt方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canuse
function canuse($pid)
{
$p = new DataAccess();
$sql = "select pid from problem where pid = {$pid} and submitable = 1";
$cnt = $p->dosql($sql);
if ($cnt == 0) {
return false;
}
if ($_SESSION['ID']) {
$sql = "SELECT * FROM submit WHERE pid = {$pid} AND uid ={$_SESSION['ID']} order by accepted desc limit 1";
$ac = $p->dosql($sql);
if ($ac) {
$e = $p->rtnrlt(0);
if ($e['accepted']) {
return false;
} else {
true;
}
}
}
return true;
}
示例2: getgds
public function getgds($judger)
{
$p = new DataAccess();
if ($judger) {
$sql = "select grid,address,memo from grader where enabled=1 and grid={$judger}";
} else {
$sql = "select grid,address,memo from grader where enabled=1 order by priority desc";
}
$cnt = $p->dosql($sql);
for ($i = 0; $i < $cnt; $i++) {
$s = array();
$d = $p->rtnrlt($i);
$this->gds = $d['address'];
$s['action'] = "state";
$this->cmds = $tmp = httpsocket($this->gds, $s);
$this->state = array_decode($tmp);
$this->state['grid'] = $d['grid'];
$this->state['memo'] = $d['memo'];
if ($this->state['state'] == "free") {
return true;
}
}
return false;
}
示例3: HTML
$acpid = $e['accepted'];
echo "<a href='../submit/code.php?id={$e['sid']}'>";
echo $STR['lang'][$e['lang']];
echo "</a> ";
评测结果($e['result'], 20);
}
}
}
?>
</td></tr>
<tr><th id="fenleito" title="单击以显示或隐藏分类标签" style="cursor:pointer">分类标签</th>
<td><div id="fenlei"><?php
$sql = "select category.cname,category.memo,category.caid from category,tag where tag.pid={$_GET[pid]} and category.caid=tag.caid";
$cnt2 = $r->dosql($sql);
for ($i = 0; $i <= $cnt2 - 1; $i++) {
$e = $r->rtnrlt($i);
HTML(" <a href='index.php?caid={$e['caid']}' target='_blank' title='{$e['memo']}' class='btn btn-mini'>{$e['cname']}</a> ");
}
if (!$acpid) {
?>
<script>
$('#fenlei').hide();
</script>
<?php
} else {
?>
<a id="addfenlei" class='btn btn-success btn-mini pull-right' href="#addcate" data-toggle='modal' title="添加分类标签"><i class='icon-plus icon-white'></i></a>
<div id='addcate' class='modal hide fade in'>
<form method="post" action="addcate.php" class='form-horizontal'>
<fieldset>
<div class='modal-header'>
示例4: DataAccess
<?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' && 有此权限('测试题目')) {
示例5:
};
</script>
<div class='row-fluid'>
<div class='span6'>
<table class='table table-condensed table-bordered fiexd'>
<tr>
<td>ID</td>
<td>收件人</td>
<td>发件箱</td>
</tr>
<?php
$sql = "select mail.*,userinfo.* from mail,userinfo where mail.fromid = {$uid} and mail.toid = userinfo.uid order by mid desc";
$cnt = $p->dosql($sql);
for ($i = 0; $i < $cnt; $i++) {
$d = $p->rtnrlt($i);
if ($d['readed'] == 0) {
echo "<tr class='success'>";
} else {
echo "<tr>";
}
echo "<td>{$d['mid']}</td> <td>";
echo "<a href='../user/detail.php?uid={$d['toid']}' target='_blank'>" . gravatar::showImage($d['email']) . "{$d['nickname']}</a></td>";
echo "<td><a href='#mail{$d['mid']}' data-toggle='modal'>{$d['title']}</a></td>";
echo "</tr>";
?>
<div id='mail<?php
echo $d['mid'];
?>
' class='modal hide fade in'>
<div class='modal-header'>
示例6: DataAccess
require_once "../include/header.php";
$p = new DataAccess();
$usr = $_REQUEST['username'];
$pwd = $_REQUEST['pwdhash'];
if (!$usr) {
$usr = $_COOKIE['cogs_usr'];
}
if (!$pwd) {
$pwd = $_COOKIE['cogs_pwd_hash'];
}
$sql = "select * from userinfo where usr='{$usr}'";
$cnt = $p->dosql($sql);
if ($cnt == 0) {
i异常("用户不存在!", 取路径("user/login.php"));
} else {
$d = $p->rtnrlt(0);
if ($pwd == $d['pwdhash'] || encode($_REQUEST['password']) == $d['pwdhash']) {
$LIB->get_userinfo($d['uid']);
$q = new DataAccess();
$sql = "UPDATE `userinfo` SET `lastip` = '{$_SERVER['REMOTE_ADDR']}' WHERE `uid` ={$d['uid']}";
$q->dosql($sql);
$sql = "insert into login(uid,ua,ip,ltime,version) values({$d['uid']},'" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "','{$_SERVER['REMOTE_ADDR']}',NOW(),'" . mysql_real_escape_string($cfg['dir_root']) . "')";
if ($SET['login_log']) {
$q->dosql($sql);
}
if ($_REQUEST['savepwd']) {
$tm = time() + 7776000;
setcookie("cogs_usr", $usr, $tm, "/");
setcookie("cogs_pwd_hash", $d['pwdhash'], $tm, "/");
}
if (!$_REQUEST['from']) {
示例7:
<dd><input name="title" type="text" id="title" value="<?php
echo $d['title'];
?>
"></dd>
<dt>阅读权限</dt>
<dd><input name="force" type="number" id="force" value="<?php
echo $d['force'];
?>
" /> </dd>
<dt>开放分组</dt>
<dd><select name="group" id="group">
<?php
$sql = "select * from groups order by gname";
$c = $q->dosql($sql);
for ($j = 0; $j < $c; $j++) {
$e = $q->rtnrlt($j);
?>
<option value="<?php
echo $e['gid'];
?>
" <?php
if ($e['gid'] == $d['group']) {
echo 'selected="selected"';
}
?>
>[<?php
echo $e['gname'];
?>
]</option>
<?php
}
示例8:
">修改</a></td>
</tr>
</table>
<?php
$sql = "select compscore.uid,userinfo.realname,userinfo.email,userinfo.nickname from compscore,userinfo where userinfo.uid=compscore.uid and compscore.ctid={$_GET[ctid]} order by uid asc";
$cnt = $p->dosql($sql);
if ($cnt) {
?>
<form method="post" action="judge.php">
选择评测机:<select name='judger' id='judger'>
<option value=0 selected=selected>自动选择</option>
<?php
$sql = "select grid,address,memo from grader where enabled=1 order by priority desc";
$cnt1 = $q->dosql($sql);
for ($i = 0; $i < $cnt1; $i++) {
$e = $q->rtnrlt($i);
echo "<option value={$e['grid']} >{$e['memo']}</option>";
}
?>
</select>
<input name="do" type="submit" id="do" class='btn' value="评测选定" />
<input name="do" type="submit" id="do" class='btn' value="评测全部" />
<input name="ctid" type="hidden" id="ctid" value="<?php
echo $_GET['ctid'];
?>
" />
</p>
<table class='table table-striped table-condensed table-bordered fiexd'>
<tr>
<th>用户</th>
示例9:
<a href="?aid=<?php
echo $d['aid'];
?>
">页面 <?php
echo $d['aid'];
?>
</a>
<?php
}
}
?>
</span><?php
if ($d['showcode']) {
$sql = "select sid,result from submit where uid='{$d['uid']}' and pid='{$d['pid']}' order by subtime desc";
$q->dosql($sql);
$e = $q->rtnrlt(0);
?>
<a href="../submit/code.php?id=<?php
echo $e['sid'];
?>
" target="_blank" title="<?php
echo $e['result'];
?>
"><i class='icon icon-download'></i><?php
echo 评测结果($e['result'], 30, true);
?>
</a>
<?php
}
?>
<div class="pull-right">
示例10: explode
</td>
<td><?php
echo $d['cname'];
?>
</td>
<td>
<select name="menu1" onchange="MM_jumpMenu('parent',this,0)" class="InputBox">
<?php
$c = 0;
if ($d['contains'] != "") {
$pbs = explode(":", $d['contains']);
foreach ($pbs as $k => $v) {
$c++;
$sql = "select probname from problem where pid={$v}";
$q->dosql($sql);
$e = $q->rtnrlt(0);
?>
<option value="../problem/problem.php?pid=<?php
echo $v;
?>
">[<?php
echo $e[probname];
?>
]</option>
<?php
}
}
?>
<option selected="selected">[<?php
echo $c;
?>
示例11: DataAccess
<?php
require_once "../include/header.php";
gethead(1, "", "邮件");
$uid = $_SESSION[ID];
$p = new DataAccess();
$sql = "select * from mail where mid = {$_GET['mid']}";
$p->dosql($sql);
$d = $p->rtnrlt();
$sql = "update mail set readed = 1 where mid = {$_GET['mid']} and toid = {$uid}";
$p->dosql($sql);
?>
<div class='container-fluid'>
<table border=2>
<tr>
<th>邮件主题</th>
<td width="80%"><?php
echo $d['title'];
?>
</td>
</tr>
<tr>
<th>发件人ID</th>
<td><?php
echo $d['fromid'];
?>
</td>
</tr>
<tr>
<th>收件人ID</th>
示例12:
<td><?php
echo $d['realname'];
?>
</td>
</tr>
<tr>
<th>用户权限</th>
<td>
<?php
$sql = "select privilege.* from privilege where uid={$d['uid']} order by pri asc";
$cnt = $q->dosql($sql);
if (!$cnt) {
echo array_search(0, $pri) . " ";
}
for ($i = 0; $i < $cnt; $i++) {
$e = $q->rtnrlt($i);
echo array_search($e['pri'], $pri) . " ";
}
?>
</td>
</tr>
<tr>
<th>登录 IP</th>
<td><a href="loginlog.php?uid=<?php
echo $d['uid'];
?>
"><?php
echo $d['lastip'];
?>
</a></td>
</tr>
示例13: calc_grade
function calc_grade($uid, $diffarr)
{
global $SET;
$ww = 0.01;
$pw = 2;
//$SET['problem_weigth'];
$cw = 1;
//$SET['contest_weigth'];
$pw *= $ww;
$cw *= $ww;
$uid = (int) $uid;
if (!$uid) {
return;
}
$p = new DataAccess();
$sql = "select uid, pid, score, accepted from submit where uid = {$uid}";
$cnt = $p->dosql($sql);
$probs = array();
for ($i = 0; $i < $cnt; $i++) {
$d = $p->rtnrlt($i);
$pid = (int) $d['pid'];
if (!$probs[$pid] || $probs[$pid] < $d['score']) {
$probs[$pid] = $d['score'];
}
}
$submt = (int) $cnt;
$accpd = 0;
$grade = 0;
foreach ($probs as $key => $value) {
$pid = (int) $key;
$score = (int) $value;
if (!$pid) {
continue;
}
if ($value == 100) {
$accpd++;
}
//echo "$pid.$score!!";
$diff = (int) $diffarr[$pid] + 1;
//echo "$grade->";
$grade += $diff * $score * $pw;
//echo "$grade. ";
}
$sql = "select score, pid from compscore where uid = {$uid}";
$cnt = $p->dosql($sql);
for ($i = 0; $i < $cnt; $i++) {
$d = $p->rtnrlt($i);
$pid = (int) $d['pid'];
$score = (int) $d['score'];
$diff = (int) $diffarr[$pid] + 1;
$grade += $diff * $score * $cw;
}
$grade = (int) $grade;
//$grade = (int)($accpd * 2.3);
$sql = "update userinfo set submited = {$submt}, accepted = {$accpd}, grade = {$grade} where uid = {$uid}";
$p->dosql($sql);
return array($submt, $accpd, $grade);
}