本文整理汇总了PHP中database::processQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP database::processQuery方法的具体用法?PHP database::processQuery怎么用?PHP database::processQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::processQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: session_hash
function session_hash(database $database, base $base, $username)
{
//generate new hash
$session_hash = $base->randomString(35);
//update old hash to new one (after checking the hahs doesn't exist)
$database->processQuery("SELECT * FROM `users` WHERE `cookie` = ?", array($session_hash), false);
if ($database->getRowCount() == 0) {
$database->processQuery("UPDATE `users` SET `cookie` = ? WHERE `username` = ? LIMIT 1", array($session_hash, $username), false);
return $session_hash;
} else {
session_hash();
}
}
示例2: array
</div>
</div>
<img class="widescroll-top" src="../img/scroll/backdrop_765_top.gif" alt="" width="765" height="50" />
<div class="widescroll">
<div class="widescroll-bgimg">
<div class="widescroll-content">
<div id="black_fields">
There is a total of <?php
echo $base->userCount();
?>
registered users.
<?php
//get the # of users
$database->processQuery("SELECT * FROM `users`", array(), false);
//pagination
$per_page = 25;
$pages = ceil($database->getRowCount() / $per_page);
//current page
$page = $_GET['page'] < 1 || $_GET['page'] > $pages || !ctype_digit($_GET['page']) ? 1 : $_GET['page'];
//where to start at when extracting
$start = ($page - 1) * $per_page;
//query to draw user list
$users = $database->processQuery("SELECT `username` FROM `users` ORDER BY `username` ASC LIMIT {$start},{$per_page}", array(), true);
?>
<table cellspacing="4" cellpadding="3">
<?php
//place holder
$ph = 0;
示例3: isset
} else {
//unban the user
$user->unban($selected_user);
echo '<b>' . $selected_user . '</b> has successfully been unbanned.';
}
} else {
if (!$banned) {
//carry out all the operations
?>
<ul> <?php
$user->ban($selected_user, isset($_POST['banip']) ? true : false);
$base->appendToFile('../forums/logs.txt', array($username . ' banned the user' . $selected_user));
echo '<li><b>' . $selected_user . '</b> has been banned.</li>';
//delete all posts and thread
if (isset($_POST['d_posts'])) {
$database->processQuery("DELETE FROM `posts` WHERE `username` = ?", array($selected_user), false);
echo '<li>Posts deleted.</li>';
//delete their threads and all posts in that thread
$threads = $database->processQuery("SELECT `id` FROM `threads` WHERE `username` = ?", array($selected_user), true);
//delete all posts in the threads the user mades
foreach ($threads as $thread) {
$database->processQuery("DELETE FROM `posts` WHERE `thread` = ?", array($thread['id']), false);
}
//delete the thread now
$database->processQuery("DELETE FROM `threads` WHERE `username` = ?", array($selected_user), false);
echo '<li>Threads deleted.</li>';
}
//delete all messages created by them
if (isset($_POST['d_messages'])) {
$database->processQuery("DELETE FROM `messages` WHERE `creator` = ?", array($selected_user), false);
echo '<li>Messaged deleted.</li>';
示例4: array
if (!$user->isLoggedIn() || !ctype_digit($_REQUEST['forum']) || !ctype_digit($_REQUEST['id']) || !ctype_digit($_REQUEST['type']) || !ctype_digit($_REQUEST['pid']) && $_REQUEST['type'] == 1) {
$base->redirect('index.php');
}
//set some variables that are used a lot throughout the page
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
$f = $_REQUEST['forum'];
$thread = $_REQUEST['id'];
//instead of typing it a million times, we're going to set our redirect url
$redirect = 'viewthread.php?forum=' . $f . '&id=' . $thread;
//make sure they are posting in a forum where they have permission
if ($user->checkMute($username) || !$thread_obj->canView($thread, $username, $rank) || !$thread_obj->canReply($thread, $rank)) {
$base->redirect($redirect);
}
//extract content for the set type
$data = $_REQUEST['type'] == 1 ? $database->processQuery("SELECT `content`,`username`,`status` FROM `posts` WHERE `id` = ?", array($_REQUEST['pid']), true) : $database->processQuery("SELECT `username`,`content`,`status`,`title` FROM `threads` WHERE `id` = ?", array($thread), true);
//check if they have permission to edit the thread/post
if ($rank < 3 && ($data[0]['username'] != $username || $data[0]['status'] == 1)) {
$base->redirect($redirect);
}
$type = $_POST['type'];
if ($user->getRank($data[0]['username']) > 3 && $rank < 4) {
$content = '<div class="frame e">You can\'t edit an administrator\'s post.</div>';
} elseif (isset($_POST['message'])) {
//send them to their newly editted post
$url = $type == 1 ? 'viewthread.php?forum=' . $f . '&id=' . $thread . '&goto=' . $_POST['pid'] : 'viewthread.php?forum=' . $f . '&id=' . $thread . '&goto=start';
if (isset($_POST['cancel'])) {
$base->redirect($url);
}
if (strlen($_POST['message']) > 2000 && $rank < 3) {
$content = '<div class="frame e">Your post can\'t be larger than 2000 characters.</div>';
示例5: database
require '../../structure/forum.php';
require '../../structure/forum.thread.php';
require '../../structure/base.php';
require '../../structure/user.php';
$database = new database($db_host, $db_name, $db_user, $db_password);
$thread = new thread($database);
$base = new base($database);
$user = new user($database);
$user->updateLastActive();
//useful variables
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
$id = $_GET['id'];
//take action then log it
if ($thread->checkExistence($id) && $thread->canView($id, $username, $rank) && $rank > 2) {
$thread_info = $database->processQuery("SELECT `autohiding` FROM `threads` WHERE `id` = ?", array($id), true);
$database->processQuery("UPDATE `threads` SET `autohiding` = ? WHERE `id` = ?", array($thread_info[0]['autohiding'] == 1 ? 0 : 1, $id), false);
$base->appendToFile('../logs.txt', array($username . ' toggled the auto-hide of the thread ' . $id));
} else {
$base->redirect('../viewthread.php?forum=' . $_GET['forum'] . '&id=' . $id . '&goto=start');
}
$redirect = 'http://' . $domain . '/forums/viewthread.php?forum=' . $_GET['forum'] . '&id=' . $id . '&goto=start';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:IE>
<!-- LeeStrong Runescape Website Source --!>
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"><!-- /Added by HTTrack -->
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
示例6: elseif
echo $x;
?>
:</td><td><input type="text" name="options[]"> Leave blank to delete</td></tr>
<?php
}
?>
<tr><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
<?php
} elseif (strlen($_POST['title']) > 35 && strlen($_POST['question']) > 250) {
echo 'Please don\'t bypass the character limit. <input type="button" value="Back" onclick="goBack()" />';
} else {
//insert poll
$database->processQuery("INSERT INTO `polls` VALUES (null, ?, ?, ?, 0)", array($_POST['title'], $_POST['question'], date('M-d-Y')), false);
$id = $database->getInsertId();
//insert all the poll options
foreach ($_POST['options'] as $option) {
if (strlen($option) > 1) {
$database->processQuery("INSERT INTO `poll_options` VALUES (null, ?, ?)", array($id, $option), false);
}
}
echo 'Your poll has successfully been created. View it <a href="../polls/poll.php?id=' . $id . '">here</a> or <a href="index.php">return to ACP home</a>.';
}
?>
</div>
</div>
</div>
<img class="widescroll-bottom" src="../img/scroll/backdrop_765_bottom.gif" alt="" width="765" height="50" />
示例7: database
<?php
require '../includes/config.php';
require '../structure/database.php';
require '../structure/base.php';
$database = new database($db_host, $db_name, $db_user, $db_password);
$base = new base();
if (isset($_POST['qfc'])) {
$thread = $database->processQuery("SELECT `id`,`parent` FROM `threads` WHERE `qfc` = ? LIMIT 1", array($_POST['qfc']), true);
if ($database->getRowCount() >= 1) {
$base->redirect('viewthread.php?forum=' . $thread[0]['parent'] . '&id=' . $thread[0]['id']);
}
}
$base->redirect('index.php');
示例8: array
$rank = $user->getRank($username);
$f = $_GET['forum'];
$i = $_GET['id'];
//preform basic checks
if (!ctype_digit($f) || !ctype_digit($i) || !$thread->checkExistence($i) || !$thread->canView($i, $username, $rank)) {
$base->redirect('index.php');
}
//if the GOTO field is set, let's skip to the selected post
if (ctype_digit($_GET['goto'])) {
$getPageNum = $thread->getPageNum($_GET['goto'], $i);
if ($getPageNum) {
$base->redirect('viewthread.php?forum=' . $f . '&id=' . $i . '&page=' . $getPageNum . '&highlight=' . $_GET['goto'] . '#' . $_GET['goto']);
}
}
//extract thread details
$detail_query = $database->processQuery("SELECT `id`,`lock`,`sticky`,`title`,`username`,`status`,`content`,`date`,`lastedit`,`qfc`,`moved`,`hidden`,`autohiding` FROM `threads` WHERE `id` = ? LIMIT 1", array($i), true);
//assign data to details[] array
$details['lock'] = $detail_query[0]['lock'];
$details['sticky'] = $detail_query[0]['sticky'];
$details['title'] = stripslashes(htmlentities($detail_query[0]['title']));
$details['username'] = $detail_query[0]['username'];
$details['status'] = $detail_query[0]['status'];
$details['content'] = $detail_query[0]['content'];
$details['date'] = $detail_query[0]['date'];
$details['lastedit'] = $detail_query[0]['lastedit'];
$details['qfc'] = $detail_query[0]['qfc'];
$details['moved'] = $detail_query[0]['moved'];
$details['hidden'] = $detail_query[0]['hidden'];
$details['autohiding'] = $detail_query[0]['autohiding'];
//apply word filter if it's a user thread
if ($user->getRank($details['username']) < 3) {
示例9: array
</title>
<link href="css/basic-3.css" rel="stylesheet" type="text/css" media="all">
<link href="css/main/title-5.css" rel="stylesheet" type="text/css" media="all">
<link rel="shortcut icon" href="img/favicon.ico" />
<?php
include 'includes/google_analytics.html';
?>
</head>
<body>
<div id="body">
<div>
<div style="text-align: center; margin-bottom: 10px; position:relative;">
<img src="img/title2/rslogo3.gif" alt="RuneScape"><br>
<?php
$database->processQuery("SELECT * FROM `users`", array(), false);
echo 'There are currently ' . number_format($database->getRowCount()) . ' people registered!';
?>
</div>
</div>
<div class="left">
<fieldset class="menu rs">
<legend><?php
echo $data['wb_abbr'];
?>
</legend>
<ul>
<?php
if ($user->isLoggedIn()) {
?>
<li class="i-create"><a href="logout.php">Logout</a></li>
示例10: foreach
<select name="id" class="button">';
foreach ($forum_index->retrieveCategories($rank) as $cat) {
foreach ($forum_index->retrieveSubForums($cat['id']) as $forum) {
$content .= '<option value="' . $forum['id'] . '">' . $forum['title'] . '</option>';
}
}
$content .= '</select>
<input type="submit" value="Select" class="button">
</form>
</div>
';
} else {
if ($forum->forumExists($_GET['id']) || $forum->forumExists($_POST['id'])) {
if (!isset($_POST['id'])) {
//forum details
$f = $database->processQuery("SELECT `icon`,`title`,`type`,`description`,`parent`,`double_posting`,`pos` FROM `forums` WHERE `id` = ? LIMIT 1", array($_GET['id']), true);
//save time
$type = $f[0]['type'];
$content = '
<form action="editforum.php" method="POST">
<table>
<input type="hidden" name="id" value="' . $_GET['id'] . '">
<tr><td>Current Icon</td><td>' . $forum->getIcon($f[0]['icon']) . '</td></tr>
<tr>
<td>Icon <br/><b>(must re-choose)</b></td><td>
<input type="radio" name="icon" value="1" /> <img src="../img/forum/icons/bug.gif" width="20" height="20">
<input type="radio" name="icon" value="2" /> <img src="../img/forum/icons/clan.gif" width="20" height="20">
<input type="radio" name="icon" value="3" /> <img src="../img/forum/icons/clan_recruitment.gif" width="20" height="20">
<input type="radio" name="icon" value="4" /> <img src="../img/forum/icons/compliments.gif" width="20" height="20">
<input type="radio" name="icon" value="5" /> <img src="../img/forum/icons/events.gif" width="20" height="20">
<input type="radio" name="icon" value="6" /> <img src="../img/forum/icons/forum_feedback.gif" width="20" height="20">
示例11: foreach
$rank = $user->getRank($username);
$f = $_GET['forum'];
//let's also make sure they have the right permissions to view the forum
if ($forum->canView($f, $rank) == false) {
$base->redirect('index.php');
}
//check if a moderator is taking action against threads
if (isset($_POST['action']) && isset($_POST['selection']) && $rank > 2) {
//get all the threads we're going to update
foreach ($_POST['selection'] as $object) {
$threads .= $object . '-';
}
//now send them off to action.php to update all the threads selected
$base->redirect('action.php?forum=' . $f . '&action=' . $_POST['action'] . '&threads=' . $threads);
}
$forum_details = $database->processQuery("SELECT `icon`,`title`,`type` FROM `forums` WHERE `id` = ? LIMIT 1", array($f), true);
//Check existence of the specified forum
if ($database->getRowCount() == 0) {
$base->redirect('index.php');
}
//pagination
$per_page = 20;
//get # of pages
$database->processQuery("SELECT * FROM `threads` WHERE `parent` = ?", array($f), false);
$pages = ceil($database->getRowCount() / $per_page);
//get current page
!ctype_digit($_GET['page']) || $_GET['page'] > $pages ? $page = 1 : ($page = $_GET['page']);
//get next link
$page < $pages ? $next = $page + 1 : ($next = $page);
//get prev link
$page - 1 >= 1 ? $prev = $page - 1 : ($prev = $page);
示例12: array
?>
</head>
<div id="body">
<div style="text-align: center; background: none;">
<div class="titleframe e">
<b>Daily Screenshot</b><br />
<a href="index.php">Main Menu</a>
</div>
</div>
<br/>
<br/>
<div class="titleframe e" style="text-align:left; color:white; width:750px; margin-left:auto; margin-right:auto;">
<?php
//pagination for daily screenshots - newest to oldest
$database->processQuery("SELECT * FROM `dailyscreenshots`", array(), false);
$pages = $database->getRowCount();
if ($pages == 0) {
echo 'No screenshots to display.';
} else {
//set basic variables
$page = $_GET['page'] > $pages || $_GET['page'] == 0 || !isset($_GET['page']) ? 1 : $_GET['page'];
$start = ($page - 1) * 1;
if ($page < $pages) {
?>
<div style="float:right;"><a href="?page=<?php
echo $page + 1;
?>
">Older Screenshot ></a> <a href="?page=<?php
echo $pages;
?>
示例13: elseif
</tr>
</table>
</form>
';
} else {
//add forum
if (strlen($_POST['forum']) > 50) {
$content = 'The forum cannot have name larger than fifty characters.';
} elseif (strlen($_POST['description']) < 3) {
$content = 'The description must be at least 3 characters.';
} elseif (!$forum->catExists($_POST['category'])) {
$content = 'The chosen category doesn\'t exist.';
} elseif (!ctype_digit($_POST['pos'])) {
$content = 'The position must be a number.';
} else {
$database->processQuery("INSERT INTO `forums` VALUES (null, ?, ?, ?, ?, ?, ?, ?)", array($_POST['category'], $_POST['pos'], $_POST['forum'], $_POST['description'], $_POST['icon'], $_POST['type'], isset($_POST['double_posting']) ? 1 : 0), false);
//forum addition successful
$content = 'You have successfully added the forum <b>' . $_POST['forum'] . '</b>. <a href="addforum.php">Add another!</a>';
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:IE>
<head>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<title><?php
echo $data['wb_title'];
?>
示例14: array
<div class="widescroll-content">
<center>
<?php
if (!isset($_GET['tracking_id'])) {
?>
<fieldset class="question">
<legend>Track</legend>
Please enter in the the tracking ID you were given.
</fieldset>
<form action="track.php" method="GET">
<input type="text" name="tracking_id" maxlength="12"><input type="submit" value="Track">
</form>
<?php
} else {
$info = $database->processQuery("SELECT `status`,`ip`,`account` FROM `tracking` WHERE `tracking_id` = ?", array($_GET['tracking_id']), true);
if ($database->getRowCount() == 0) {
echo 'No recovery request exists with this tracking ID. <input type="button" value="Back" onclick="goBack()" />';
} elseif ($_SERVER['REMOTE_ADDR'] != $info[0]['ip']) {
echo 'This isn\'t yours to check. <input type="button" value="Back" onclick="goBack()" />';
} elseif ($info[0]['status'] == 1) {
if (!isset($_POST['password']) || !isset($_POST['confirm'])) {
?>
<fieldset class="question">
<legend>Accepted</legend>
Your recovery was accepted. Please enter in the new details of your account.
</fieldset>
<form action="track.php?tracking_id=<?php
echo $_GET['tracking_id'];
示例15: database
<?php
require '../includes/config.php';
require '../structure/database.php';
require '../structure/base.php';
require '../structure/user.php';
require '../structure/msgcenter.php';
$database = new database($db_host, $db_name, $db_user, $db_password);
$base = new base($database);
$user = new user($database);
$msgcenter = new msgcenter($database);
$user->updateLastActive();
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
if ($rank < 4 || !$msgcenter->canView($_GET['id'], $username, $rank)) {
$base->redirect('viewmessage.php?id=' . $_GET['id']);
} else {
$database->processQuery("DELETE FROM `replies` WHERE `conversation` = ?", array($_GET['id']), false);
$database->processQuery("DELETE FROM `messages` WHERE `id` = ?", array($_GET['id']), false);
$base->redirect('index.php');
}