本文整理汇总了PHP中MySQL::from方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::from方法的具体用法?PHP MySQL::from怎么用?PHP MySQL::from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQL
的用法示例。
在下文中一共展示了MySQL::from方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MySQL
$result = $hour . ':' . $minute . ':' . $second;
}
return $result;
}
?>
<?php
require_once "api.php";
$db = new MySQL();
$start = $app->setting->get("startTime", time() + 10);
if ($start > time()) {
die('<center><h1><a href="index.php" style="color: #000000;">Rank not start !</a></h1></center></body></html>');
}
$time = $app->setting->get("lastCache", 0);
if (time() - intval($time) > 30) {
$u_list = $app->user->getUserList();
$p_list = $db->from("Problem")->select()->fetch_all();
$list = array();
for ($i = 0; $i < count($u_list); ++$i) {
$list[$i] = array('user' => $u_list[$i], 'time' => 0, 'deal' => 0, 'do' => 0);
for ($j = 0; $j < count($p_list); ++$j) {
$yes = $db->from("Record")->where("`oid`='" . $p_list[$j]['id'] . "' AND `user`='" . $u_list[$i] . "' AND `result`='Accepted'")->order("ASC", "time")->select()->fetch_one();
if ($yes == "") {
$no = $db->from("Record")->where("`oid`='" . $p_list[$j]['id'] . "' AND `user`='" . $u_list[$i] . "' AND `result`<>'Accepted'")->order("ASC", "time")->select()->num_rows();
} else {
$no = $db->from("Record")->where("`oid`='" . $p_list[$j]['id'] . "' AND `user`='" . $u_list[$i] . "' AND `result`<>'Accepted' AND `time`<" . $yes['time'])->order("ASC", "time")->select()->num_rows();
}
$list[$i][$j] = array('pid' => $p_list[$j]['id'], 'result' => $yes == "" ? "no" : "yes", 'time' => $yes == "" ? "0" : intval($yes['time']) - $start, 'wrong' => $no);
if ($yes != "" || $no != 0) {
$list[$i]['do']++;
}
if ($yes != "") {
示例2: check
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Index</title>
<script>
function check()
{
return confirm('您确认更改这些信息么?\n提交过后将会重新审核账户!');
}
</script>
</head>
<body>
<center>
<?php
require_once "frame.php";
$db = new MySQL();
$info = $db->from("User")->where("`id`='" . $id . "'")->select()->fetch_one();
?>
<form action='profile.php?id=<?php
echo $id;
?>
' method='post' onsubmit='return check();'>
<input type='hidden' name='id' value='<?php
echo $info['id'];
?>
' />
<table>
<tr>
<td>
<label>姓名:</label><input type='text' name='nick' value='<?php
echo $info['nick'];
?>
示例3: MySQL
<?php
require_once "frame.php";
?>
<table>
<tr>
<td>
姓名
</td>
<td>
可用
</td>
<td>
操作
</td>
</tr>
<?php
$db = new MySQL();
$list = $db->from("User")->where("`power`='1'")->select()->fetch_all();
for ($i = 0; $i < count($list); ++$i) {
echo "<tr>";
echo "<td>" . $list[$i]['nick'] . "</td>";
echo "<td>" . $list[$i]['use'] . "</td>";
echo "<td><a href='profile.php?id=" . $list[$i]['id'] . "'>详细信息</a> | <a href=uuu.php?action=yes&id=" . $list[$i]['id'] . ">通过注册</a> | <a href=uuu.php?action=no&id=" . $list[$i]['id'] . ">禁止注册</a></td>";
echo "</tr>";
}
?>
</table>
</center>
</body>
</html>
示例4: MySQL
</td>
<td>
Time
</td>
<td>
Language
</td>
<td>
Submit Time
</td>
</tr>
<?php
require_once 'api.php';
require_once 'classes/Record.php';
$db = new MySQL();
$arr = $db->from('Record')->where('`id`=\'' . $_GET['id'] . '\'')->select('id')->fetch_all();
for ($i = 0; $i < count($arr); ++$i) {
$pro = new Record($arr[$i]['id']);
$res = $pro->getInfo();
?>
<tr>
<td>
<?php
echo $res['id'];
?>
</td>
<td>
<?php
echo $res['user'];
?>
</td>
示例5: MySQL
<table width='1200'>
<tr>
<td width='200'>
<font style='padding-left: 10px;'>😇控制��</font>
</td>
<td width='1000'>
<a href='../index.php'>官网首页</a>
<a target='windows' href='profile.php'>我的信�</a>
<a href='index.php?action=logout'>退出系统</a>
</td>
</tr>
<tr>
<td width='200'>
<?php
$db = new MySQL();
switch ($db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one()['power']) {
case '0':
?>
<a target='windows' class='button' href='list_a.php'>项目列表</a><br />
<a target='_blank' class='button' href='hook.php'>æ–‡ç« ç®¡ç�†</a><br />
<a target='windows' class='button' href='user_a.php'>è´¦æˆ·å®¡æ ¸</a><br />
<?php
break;
case '1':
?>
<a target='windows' class='button' href='list_s.php'>项目列表</a><br />
<a target='_blank' class='button' href='hook.php'>æ–‡ç« ç®¡ç�†</a><br />
<a target='windows' class='button' href='user_s.php'>è´¦æˆ·å®¡æ ¸</a><br />
<?php
break;
case '2':
示例6: MySQL
<?php
/**
Author: SpringHack - springhack@live.cn
Last modified: 2015-12-29 10:13:25
Filename: register.php
Description: Created by SpringHack using vim automatically.
**/
require_once "user.common.php";
$db = new MySQL();
if (isset($_GET['type'])) {
$qu = $db->from("User")->where("`user`='" . $_POST['user'] . "'")->select()->num_rows();
if ($qu == 1) {
redirect("error.php");
}
$db->value(array('id' => uniqid(), 'user' => $_POST['user'], 'pass' => $_POST['pass'], 'nick' => $_POST['nick'], 'power' => $_GET['type'], 'birthday' => $_POST['birthday'], 'school' => $_POST['school'], 'use' => $_GET['type'] == '1' ? 'yes' : 'no'))->insert("User");
redirect("login.php");
}
$school_list = $db->query("SELECT DISTINCT `school` FROM User where `use`='yes' AND `school`<>'none'")->fetch_all();
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Index</title>
<script language='javascript' src='js/jquery-2.1.3.min.js'></script>
<script language='javascript'>
function school()
{
$("#student").hide();
$("#school").show();
示例7: redirect
Last modified: 2015-11-17 10:39:58
Filename: modify.php
Description: Created by SpringHack using vim automatically.
**/
require_once "user.common.php";
require_once "tech.common.php";
if (!isset($_SESSION['id'])) {
redirect("login.php");
}
if ($db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one()['use'] != 'yes') {
redirect("none.php");
}
$db = new MySQL();
switch ($_GET['action']) {
case 'check':
if ($db->from("Tech")->where("`user`='" . $_SESSION['id'] . "' AND `id`='" . $_GET['id'] . "'")->select()->num_rows() == 1) {
$db->set(array('hack' => 'check', 'reason' => ''))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
}
break;
case 'remod':
$db->set(array('hack' => 'remod', 'reason' => $_GET['str']))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
break;
case 'post':
$db->set(array('hack' => 'post', 'reason' => ''))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
break;
case 'recheck':
$db->set(array('hack' => 'recheck', 'reason' => $_GET['str']))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
break;
case 'ok':
$db->set(array('hack' => 'ok', 'reason' => ''))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
default:
示例8: MySQL
/**
Author: SpringHack - springhack@live.cn
Last modified: 2015-12-20 21:45:06
Filename: expert.php
Description: Created by SpringHack using vim automatically.
**/
require_once "user.common.php";
$db = new MySQL();
$school_list = $db->query("SELECT DISTINCT `school` FROM User where `use`='yes' AND `school`<>'none'")->fetch_all();
require_once 'expert.common.php';
if (isset($_POST['submit'])) {
if ($_FILES['pic']['error'] == 0) {
move_uploaded_file($_FILES["pic"]["tmp_name"], '../uploads/' . $_POST['user_id'] . '.png');
}
if ($db->from("Expert")->where("`user_id`='" . $_POST['user_id'] . "'")->select()->num_rows() != 0) {
if ($db->from("Expert")->where("`user_id`='" . $_POST['user_id'] . "' AND `user_pw`='" . $_POST['user_pw'] . "'")->select()->num_rows() != 1) {
redirect('error.php');
} else {
$id = 'old';
}
} else {
$id = 'new';
}
$_POST['time'] = time();
$_POST['work'] = serialize($_POST['work']);
if ($id == 'new') {
unset($_POST['submit']);
$db->value($_POST)->insert('Expert');
echo $db->error();
} else {
示例9: redirect
<?php
/**
Author: SpringHack - springhack@live.cn
Last modified: 2015-11-03 17:52:54
Filename: uuu.php
Description: Created by SpringHack using vim automatically.
**/
?>
<?php
require_once "user.common.php";
require_once "tech.common.php";
if (!isset($_SESSION['id'])) {
redirect("login.php");
}
if ($db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one()['use'] != 'yes') {
redirect("error.php");
}
$db = new MySQL();
if ($_GET['action'] == 'yes') {
$db->set(array('use' => 'yes'))->where("`id`='" . $_GET['id'] . "'")->update("User");
} else {
$db->from("User")->where("`id`='" . $_GET['id'] . "'")->delete();
}
?>
<script>
alert("操作成功完成!");
history.back(-1);
</script>
示例10: switch
**/
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'modifyUser':
require_once '../api.php';
if ($app->user->userRenew($_SESSION['uu'], $_SESSION['new_pass'], "", $app->user->getPower())) {
header('Location: profile.php');
} else {
header('Location: error.php');
}
break;
default:
break;
}
exit(0);
}
if (!isset($_GET['do'])) {
require_once "user.common.php";
$db = new MySQL();
$qu = $db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one();
$_SESSION['uu'] = $qu['user'];
$_SESSION['pp'] = $qu['pass'];
redirect('hook.php?do=yes');
} else {
require_once '../api.php';
if ($app->user->userLogin($_SESSION['uu'], $_SESSION['pp'])) {
header('Location: ../admin/');
} else {
header('Location: error.php');
}
}
示例11: MySQL
require_once "frame.php";
?>
<table>
<tr>
<td>
姓名
</td>
<td>
可用
</td>
<td>
操作
</td>
</tr>
<?php
$db = new MySQL();
$school = $db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one()['school'];
$list = $db->from("User")->where("`school`='" . $school . "' AND `power`='2'")->select()->fetch_all();
for ($i = 0; $i < count($list); ++$i) {
echo "<tr>";
echo "<td>" . $list[$i]['nick'] . "</td>";
echo "<td>" . $list[$i]['use'] . "</td>";
echo "<td><a href='profile.php?id=" . $list[$i]['id'] . "'>详细信息</a> | <a href=uuu.php?action=yes&id=" . $list[$i]['id'] . ">通过注册</a> | <a href=uuu.php?action=no&id=" . $list[$i]['id'] . ">禁止注册</a></td>";
echo "</tr>";
}
?>
</table>
</center>
</body>
</html>
示例12: MySQL
<?php
/**
Author: SpringHack - springhack@live.cn
Last modified: 2015-12-20 19:35:09
Filename: login.php
Description: Created by SpringHack using vim automatically.
**/
require_once "user.common.php";
$login = false;
if (isset($_POST['submit'])) {
$db = new MySQL();
$qu = $db->from("User")->where("`user`='" . $_POST['user'] . "' AND `pass`='" . $_POST['pass'] . "'")->select();
if ($qu->num_rows() == 1) {
$_SESSION['id'] = $qu->fetch_one()['id'];
$login = true;
} else {
redirect("error.php");
}
}
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
<script>
<?php
if ($login) {
echo "location.href='index.php';";
}
示例13: MySQL
if ($_GET['type'] != '综合数据库' && $_GET['type'] != '专家数据库') {
$list = $app->eassy->getList($_GET['type'], 20, $page);
for ($i = 0; $i < count($list); ++$i) {
$post = $app->eassy->getEassy($list[$i]);
echo "<a href='view.php?id=" . $post['tid'] . "' class='sub_link'>" . $post['title'] . "</a>";
}
}
if ($_GET['type'] == '综合数据库') {
$sql = NULL;
require_once 'Config.user.php';
$ndb = new MySQL();
$list = $ndb->from('Tech')->where("`hack`='post' OR `hack`='ok'")->limit(20, $page)->select()->fetch_all();
for ($i = 0; $i < count($list); ++$i) {
echo "<a href='editor/insert.php?id=" . $list[$i]['id'] . "' class='sub_link'>" . $list[$i]['owner'] . ' - ' . $list[$i]['p_name'] . "</a>";
}
}
if ($_GET['type'] == '专家数据库') {
$sql = NULL;
require_once 'Config.user.php';
$ndb = new MySQL();
$list = $ndb->from('Expert')->limit(20, $page)->select()->fetch_all();
for ($i = 0; $i < count($list); ++$i) {
echo "<a href='editor/expert.php?user_id=" . $list[$i]['user_id'] . "' class='sub_link'>" . $list[$i]['school'] . ' - ' . $list[$i]['name'] . "</a>";
}
}
?>
<script language='javascript' src='Widget/pageSwitcher/pageSwitcher.js'></script>
</div>
</div>
<?php
require_once 'bottom.php';
示例14: die
**/
require_once "api.php";
if (!$app->user->isLogin()) {
die('<center><a href=\'admin/status.php?action=login&url=../index.php\'>Please login or register first!</a></center>');
}
require_once "classes/Problem.php";
$start = $app->setting->get("startTime", time() + 10);
if ($start > time()) {
die('<center><h1><a href="index.php" style="color: #000000;">Contest not start !</a></h1></center></body></html>');
}
$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>
示例15: isset
<td>
Time
</td>
<td>
Language
</td>
<td>
Submit Time
</td>
</tr>
<?php
$start = isset($_GET['page']) ? (intval($_GET['page']) - 1) * 10 : 0;
require_once 'api.php';
require_once 'classes/Record.php';
$db = new MySQL();
$arr = $db->from('Record')->limit(10, $start)->order('DESC', 'time')->select('id')->fetch_all();
for ($i = 0; $i < count($arr); ++$i) {
$pro = new Record($arr[$i]['id']);
$res = $pro->getInfo();
?>
<tr>
<td>
<?php
echo $res['id'];
?>
</td>
<td>
<?php
echo $res['user'];
?>
</td>