当前位置: 首页>>代码示例>>PHP>>正文


PHP DataAccess::dosql方法代码示例

本文整理汇总了PHP中DataAccess::dosql方法的典型用法代码示例。如果您正苦于以下问题:PHP DataAccess::dosql方法的具体用法?PHP DataAccess::dosql怎么用?PHP DataAccess::dosql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataAccess的用法示例。


在下文中一共展示了DataAccess::dosql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:Zhi2014,项目名称:cogs,代码行数:22,代码来源:random.php

示例2:

  $('.modal').modal('hide');
  $('#sendmail').modal('show');
};
</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'];
    ?>
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:index.php

示例3: DataAccess

    $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']) {
            $_REQUEST['from'] = base64_encode("/" . $SET['global_root']);
        }
        i提示("用户 {$d['nickname']} 登录成功!{$_REQUEST['savepwd']}", $_REQUEST['from']);
    } else {
        i异常("密码错误,登录失败!", 取路径("user/login.php"));
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:dologin.php

示例4: DataAccess

<?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']}"));
}
开发者ID:Zhi2014,项目名称:cogs,代码行数:20,代码来源:addsol.php

示例5: writedb_comp

 public function writedb_comp($csid)
 {
     $p = new DataAccess();
     $sql = "update compscore set score={$this->s_score}, result='{$this->s_detail}', memory='{$this->avgmemory}', runtime='{$this->totaltime}' where csid={$csid}";
     $p->dosql($sql);
 }
开发者ID:Zhi2014,项目名称:cogs,代码行数:6,代码来源:compobj.php

示例6:

</dd>
<dt>页面标题</dt>
<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>
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:editpage.php

示例7:

echo $d[ctid];
?>
">修改</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'>
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:comptime.php

示例8: 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);
}
开发者ID:Zhi2014,项目名称:cogs,代码行数:58,代码来源:func.php

示例9: DataAccess

<?php

require_once "../include/header.php";
gethead(8, "sess", "");
过滤();
$p = new DataAccess();
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) {
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:addcate.php

示例10: DataAccess

<?php

require_once "../include/header.php";
$p = new DataAccess();
$name = $_GET['name'];
$sql = "SELECT pid FROM problem WHERE filename='{$name}'";
$rows = $p->dosql($sql);
echo $rows;
开发者ID:Zhi2014,项目名称:cogs,代码行数:8,代码来源:checkfilename.php

示例11:

  <?php 
if (有此权限('查看用户') || $_SESSION['ID'] == $d['uid']) {
    ?>
  <tr>
    <th>真实姓名</th>
    <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'];
    ?>
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:detail.php

示例12:

?>
</table>
<?php 
if (time() > $e['endtime']) {
    ?>
<table class='table table-striped table-condensed table-bordered fiexd'>
<tr>
<th>用户</th>
<th>结果</th>
<th>时间</th>
<th>内存</th>
<th>得分</th>
</tr>
<?php 
    $sql = "select * from compscore,userinfo where userinfo.uid=compscore.uid and compscore.pid={$pid} and compscore.ctid={$ctid} order by compscore.score desc, compscore.runtime asc, compscore.memory asc";
    $cnt = $r->dosql($sql);
    for ($i = 0; $i < $cnt; $i++) {
        $f = $r->rtnrlt($i);
        ?>
<tr>
<td><a href="../user/detail.php?uid=<?php 
        echo $f['uid'];
        ?>
" target="_blank">
<?php 
        echo gravatar::showImage($f['email'], 14);
        echo 有此权限('查看用户') ? $f['realname'] : $f['nickname'];
        ?>
</a></td>
<td class="wrap"><a href="code.php?csid=<?php 
        echo $f['csid'];
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:problem.php

示例13: DataAccess

<dt>E-mail</dt>
<dd><input class="InputBox" name="email" type="email" value=<?php 
    echo $d[email];
    ?>
></dd>
<dt>阅读权限</dt>
<dd><input name="readforce" type="text" value="<?php 
    echo $d[readforce];
    ?>
"></dd>
<dt>所属分组</dt>
<dd><select name="gbelong" id="gbelong">
<?php 
    $q = new DataAccess();
    $sql2 = "select * from groups";
    $cnt2 = $q->dosql($sql2);
    for ($i = 0; $i <= $cnt2 - 1; $i++) {
        $e = $q->rtnrlt($i);
        ?>
      <option value="<?php 
        echo $e[gid];
        ?>
" <?php 
        if ($d[gbelong] == $e[gid]) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $e[gname];
        ?>
</option>
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:edituser.php

示例14: 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' && 有此权限('测试题目')) {
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:judge.php

示例15: foreach

"></td>
    <td id="nickname<?php 
    echo $rowcnt;
    ?>
"><a href="../user/detail.php?uid=<?php 
    echo $d['uid'];
    ?>
" target="_blank">
<?php 
    echo gravatar::showImage($d['email'], 14);
    echo 有此权限('查看用户') ? $d['realname'] : $d['nickname'];
    ?>
</a></td>
<?php 
    $sql = "select pid,result,score,csid,lang from compscore where uid='{$d['uid']}' and ctid={$_GET[ctid]} order by pid asc";
    $cnt_sub = $q->dosql($sql);
    $sum = 0;
    $rank = $mbarray;
    for ($j = 0; $j < $cnt_sub; $j++) {
        $e = $q->rtnrlt($j);
        $sum += $e[score];
        $rank[$e[pid]][csid] = $e[csid];
        $rank[$e[pid]][score] = $e[score];
        $rank[$e[pid]][result] = $e[result];
    }
    foreach ($pbs as $k => $v) {
        ?>
    <td id="result<?php 
        echo $v;
        ?>
_<?php 
开发者ID:Zhi2014,项目名称:cogs,代码行数:31,代码来源:report.php


注:本文中的DataAccess::dosql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。