本文整理汇总了PHP中database::num_rows方法的典型用法代码示例。如果您正苦于以下问题:PHP database::num_rows方法的具体用法?PHP database::num_rows怎么用?PHP database::num_rows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::num_rows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
/**
* Layout Page Logic
* @return
* @param $db Object
*/
function __construct(database $db, user $user)
{
$this->db =& $db;
$this->user =& $user;
$this->sub_page = Kit::GetParam('sp', _GET, _WORD, 'view');
$this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
// If we have modify selected then we need to get some info
if ($this->layoutid != '') {
// get the permissions
Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
$this->auth = $user->LayoutAuth($this->layoutid, true);
if (!$this->auth->edit) {
trigger_error(__("You do not have permissions to edit this layout"), E_USER_ERROR);
}
$this->sub_page = "edit";
$sql = " SELECT layout, description, userid, retired, xml FROM layout ";
$sql .= sprintf(" WHERE layoutID = %d ", $this->layoutid);
if (!($results = $db->query($sql))) {
trigger_error($db->error());
trigger_error(__("Cannot retrieve the Information relating to this layout. The layout may be corrupt."), E_USER_ERROR);
}
if ($db->num_rows($results) == 0) {
$this->has_permissions = false;
}
while ($aRow = $db->get_row($results)) {
$this->layout = Kit::ValidateParam($aRow[0], _STRING);
$this->description = Kit::ValidateParam($aRow[1], _STRING);
$this->retired = Kit::ValidateParam($aRow[3], _INT);
$this->xml = $aRow[4];
}
}
}
示例2: database
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$set = array();
$settq = $db->query("SELECT * FROM settings");
while ($r = $db->fetch_row($settq)) {
$set[$r['conf_name']] = $r['conf_value'];
}
if ($_POST['username'] == "" || $_POST['password'] == "") {
die("<h3>{$set['game_name']} Error</h3>\r\n{$nofill}<br>\r\n<a href=login.php>> Back</a>");
}
$uq = $db->query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')");
if ($db->num_rows($uq) == 0) {
die("<h3>{$set['game_name']} Error</h3>\r\n{$invalid}<br>\r\n<a href=login.php>> {$lerrortry}</a>");
} else {
$_SESSION['loggedin'] = 1;
$mem = $db->fetch_row($uq);
$_SESSION['userid'] = $mem['userid'];
$IP = $_SERVER['REMOTE_ADDR'];
$IP = addslashes($IP);
$IP = mysql_real_escape_string($IP);
$IP = strip_tags($IP);
$db->query("UPDATE users SET lastip_login='{$IP}',last_login=unix_timestamp() WHERE userid={$mem['userid']}");
$db->query("UPDATE users SET active=1 WHERE userid={$mem['userid']}");
if ($set['validate_period'] == "login" && $set['validate_on']) {
$db->query("UPDATE users SET verified=0 WHERE userid={$mem['userid']}");
}
header("Location: index.php");
示例3: database
<?php
require "libraries/database.php";
require "phpMailer/class.phpmailer.php";
require "phpMailer/PHPMailerAutoload.php";
$maXacNhan = md5(uniqid(rand()));
$email = $_REQUEST['email'];
$tenHienThi = $_REQUEST['tenHienThi'];
$matKhau = $_REQUEST['matKhau'];
$data = new database("timphongtro");
$sql1 = "SELECT * FROM taikhoan WHERE email='{$email}'";
$data->query($sql1);
if ($data->num_rows() == 0) {
$sql = "INSERT INTO dangkytaikhoan (`MaXacNhan`, `email`, `TenHienThi`, `MatKhau`) VALUES ('{$maXacNhan}','{$email}','{$tenHienThi}','{$matKhau}')";
$result = $data->query($sql);
if ($result) {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->Debugoutput = "html";
// Lỗi trả về hiển thị với cấu trúc HTML
$mail->Host = "smtp.gmail.com";
//host smtp để gửi mail
$mail->Port = 587;
// cổng để gửi mail
$mail->SMTPSecure = "tls";
//Phương thức mã hóa thư - ssl hoặc tls
$mail->SMTPAuth = true;
//Xác thực SMTP
$mail->Username = "banamhd1999@gmail.com";
// Tên đăng nhập tài khoản Gmail
示例4: startheaders
function startheaders()
{
global $ir, $set;
global $_CONFIG;
define("MONO_ON", 1);
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$set = array();
$settq = $db->query("SELECT * FROM settings");
while ($r = $db->fetch_row($settq)) {
$set[$r['conf_name']] = $r['conf_value'];
}
$q = $db->query("SELECT userid FROM users");
$membs = $db->num_rows($q);
$q = $db->query("SELECT userid FROM users WHERE bankmoney>-1");
$banks = $db->num_rows($q);
$q = $db->query("SELECT userid FROM users WHERE gender='Male'");
$male = $db->num_rows($q);
$q = $db->query("SELECT userid FROM users WHERE gender='Female'");
$fem = $db->num_rows($q);
$money = money_formatter($ir['money']);
$crystals = money_formatter($ir['crystals'], '');
$cn = 0;
// Users Online , Counts Users Online In Last 15 minutes
$q = $db->query("SELECT * FROM users WHERE laston>unix_timestamp()-15*60 ORDER BY laston DESC");
$online = $db->num_rows($q);
$ec = $ir['new_events'];
$mc = $ir['new_mail'];
$ids_checkpost = urldecode($_SERVER['QUERY_STRING']);
if (eregi("[\\'|'/'\\''<'>'*'~'`']", $ids_checkpost) || strstr($ids_checkpost, 'union') || strstr($ids_checkpost, 'java') || strstr($ids_checkpost, 'script') || strstr($ids_checkpost, 'substring(') || strstr($ids_checkpost, 'ord()')) {
$passed = 0;
echo "<center> <font color=red> Hack attempt <br/>!!! WARNING !!! <br/>\n\nMalicious Code Detected! The staff has been notified.</font></center>";
event_add(1, " <a href='viewuser.php?u={$ir['userid']}'> <font color=red> " . $ir['username'] . "</font> </a> <b> Tried to use [" . $_SERVER['SCRIPT_NAME'] . "{$ids_checkpost}].. ", $c);
$h->endpage();
exit;
}
echo <<<EOF
<!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=iso-8859-1" />
<title>{$set['game_name']} - Massive Multiplayer Online Role Playing Game </title>
<meta name="keywords" content="RPG, Online Games, Online Mafia Game" />
<meta name="description" content=" {$set['game_name']} - Online Mafia Game " />
<meta name="author" content="Mafia Game Scripts " />
<meta name="copyright" content="Copyright {$_SERVER['HTTP_HOST']} " />
<link rel="SHORTCUT ICON" href="favicon.ico" />
<script src="js/jquery-1.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/styleold.css" type="text/css" />
<link rel="stylesheet" href="css/stylenew.css" type="text/css" />
<script type="text/javascript" src="js/header.js"></script>
<style type="text/css">
.boston a{
background:url(images/boston.jpg) no-repeat;
}
.boston a:hover{
background:url(images/boston_hover.jpg) no-repeat;
}
</style>
<!--<script type="text/javascript">
\$(document).ready(function(){
\$.get("userstatajax.php",function(res){
if(res)
{
var resarray = res.split('||||||');
\$('.profile_mid').html(resarray[0]);
\$('#points_money').html(resarray[1]);
}
});
});
</script>-->
</head>
<body id="sub" class="yui-skin-sam">
<div id="pagecontainer">
<!-- Header Part Starts -->
<div class="headerpart">
<div class="onlinegame"></div>
<div class="toplist">
</div>
</div>
<!-- //Header Part End -->
<!-- Inner Page Top Starts -->
<div class="innertopbg">
<div class="toprow1">
<div class="toprow1_col1">
<div class="logo"><a href="index.php"><img src="images/logo.jpg" alt="Logo"/></a></div>
<div class="needbtn"></div>
<div class="top_leftbtn">
//.........这里部分代码省略.........
示例5: confirm_command
public static function confirm_command($nick, $ircdata = array())
{
$code = $ircdata[0];
if (trim($code) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'CONFIRM'));
return false;
}
// wrong syntax
if (!($user = services::user_exists($nick, false, array('display', 'id')))) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_UNREGISTERED);
return false;
}
// unregistered
$code_array = database::select('validation_codes', array('nick', 'code'), array('nick', '=', $nick, 'AND', 'code', '=', $code));
if (database::num_rows($code_array) == 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSCODE);
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_VALIDATED);
// let them know.
database::update('users', array('validated' => 1), array('id', '=', $user->id));
// user is now validated.
database::delete('validation_codes', array('nick', '=', $nick, 'AND', 'code', '=', $code));
// delete the code now that we've validated them
core::alog(core::$config->nickserv->nick . ': ' . $nick . ' activated');
// logchan
}
// no passcode found
}
示例6: __autoload
<?php
function __autoload($class_name)
{
include_once $class_name . ".class.php";
}
$numq = "SELECT * FROM `test`";
$db = new database();
$res = $db->execute($numq);
//总数据条数
$nums = $db->num_rows($res);
$pagesize = 3;
if (!empty($_GET['pagesize'])) {
$pagesize = $_GET['pagesize'];
}
$page = new page($pagesize, $nums);
//$page->show_page_way_1();
$page->show_page_way_3();
$page->show_page_result();
示例7: Copyright
| Software Name : Mafia Game Scripts Online Mafia Game
| Software Author : Mafia Game Scripts
| Software Version : Version 2.3.1 Build 2301
| Website : http://www.mafiagamescript.net/
| E-mail : support@mafiagamescript.net
|**************************************************************************************************
| The source files are subject to the Mafia Game Script End-User License Agreement included in License Agreement.html
| The files in the package must not be distributed in whole or significant part.
| All code is copyrighted unless otherwise advised.
| Do Not Remove Powered By Mafia Game Scripts without permission .
|**************************************************************************************************
| Copyright (c) 2010 Mafia Game Script . All rights reserved.
|**************************************************************************************************/
include "config.php";
include "language.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$db->query("UPDATE users set hospital=hospital-1 WHERE hospital>0");
$db->query("UPDATE `users` SET jail=jail-1 WHERE `jail` > 0");
$db->query("UPDATE users SET traveltime=traveltime-1 WHERE traveltime > 0");
$db->query("UPDATE users SET bguard=bguard-1 WHERE bguard>0");
$db->query("UPDATE users SET bguard=0 WHERE bguard<0");
$hc = $db->num_rows($db->query("SELECT * FROM users WHERE hospital > 0"));
$jc = $db->num_rows($db->query("SELECT * FROM users WHERE jail > 0"));
$db->query("UPDATE settings SET conf_value='{$hc}' WHERE conf_name='hospital_count'");
$db->query("UPDATE settings SET conf_value='{$jc}' WHERE conf_name='jail_count'");
示例8: database
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$set = array();
$settq = $db->query("SELECT * FROM settings");
while ($r = $db->fetch_row($settq)) {
$set[$r['conf_name']] = $r['conf_value'];
}
$domain = $set['domain'];
if ($_SESSION['userid']) {
if ($guest) {
$gutxt = " AND guest=1";
}
$is = $db->query("SELECT * FROM users WHERE userid='{$userid}'{$gutxt}");
$useex = $db->num_rows($is);
if ($useex > 0) {
$ir = $db->fetch_row($is);
$namenospaces = str_replace(" ", "_", $ir['username']);
$_SESSION['username'] = $namenospaces;
} else {
if (!$userid) {
die('error');
} else {
if ($guest == 1) {
header('Location: login.php');
} else {
$name = $user->fbc_name;
$db->query("INSERT INTO users (userid, username, money) VALUES('{$userid}', '{$name}', 1000)");
$is = $db->query("SELECT * FROM users WHERE userid='{$userid}'");
$ir = $db->fetch_row($is);
示例9: identify_command
public static function identify_command($nick, $ircdata = array())
{
$password = $ircdata[0];
if (trim($password) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'IDENTIFY'));
return false;
}
// wrong syntax damit!
if ($user = services::user_exists($nick, false, array('display', 'pass', 'identified', 'validated', 'salt', 'vhost'))) {
if ($user->validated == 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_AWAITING_VALIDATION);
return false;
} elseif ($user->identified == 1) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ALREADY_IDENTIFIED);
return false;
} else {
if ($user->pass == sha1($password . $user->salt)) {
timer::remove(array('ns_identify', 'secured_callback', array($nick)));
// remove the secured timer. if there is one
ircd::on_user_login($nick);
// registered mode
database::update('users', array('identified' => 1, 'last_hostmask' => core::get_full_hostname($nick), 'last_timestamp' => 0), array('display', '=', $nick));
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_IDENTIFIED);
// right, standard identify crap
core::alog(core::$config->nickserv->nick . ': ' . core::get_full_hostname($nick) . ' identified for nick ' . core::$nicks[$nick]['nick']);
// logchan
if ($user->vhost != '' && isset(modules::$list['os_vhost'])) {
if (substr_count($user->vhost, '@') == 1) {
$new_host = explode('@', $user->vhost);
$ident = $new_host[0];
$host = $new_host[1];
ircd::setident(core::$config->operserv->nick, $user->display, $ident);
ircd::sethost(core::$config->operserv->nick, $user->display, $host);
} else {
ircd::sethost(core::$config->operserv->nick, $user->display, $user->vhost);
}
}
// first thing we do, check if they have a vhost, if they do, apply it.
$failed_attempts = database::select('failed_attempts', array('nick', 'mask', 'time'), array('nick', '=', $nick));
if (database::num_rows($failed_attempts) > 0) {
services::communicate(core::$config->nickserv->nick, $nick, '' . database::num_rows($failed_attempts) . ' failed login(s) since last login.');
while ($row = database::fetch($failed_attempts)) {
services::communicate(core::$config->nickserv->nick, $nick, 'Failed login from: ' . $row->mask . ' on ' . date("F j, Y, g:i a", $row->time) . '');
}
// loop through the failed attempts messaging them to the user
database::delete('failed_attempts', array('nick', '=', $nick));
// clear them now that they've been seen
}
// we got any failed attempts? HUMM
$hostname = core::get_full_hostname($nick);
// generate a hostname.
if (core::$config->settings->mode_on_id == 'yes' && isset(modules::$list['cs_levels'])) {
foreach (core::$chans as $chan => $cdata) {
$access_array = cs_levels::get_access($chan);
// get the access array
if ($nick == core::$config->chanserv->nick) {
continue;
}
// skip us :D
$hostname = core::get_full_hostname($nick);
// get the hostname ready.
foreach ($access_array as $target => $access) {
if ($target == $nick) {
$remove_access = false;
// don't remove access
cs_levels::give_access($chan, $nick, $access, chanserv::check_flags($chan, array('S')));
// give them access
continue 2;
// continue to next loop cause we've found a match
} elseif (strpos($target, '@') !== false && services::match($hostname, $target)) {
$remove_access = false;
// don't remove access
cs_levels::give_access($chan, $nick, $access, chanserv::check_flags($chan, array('S')));
// give them access
continue 2;
// continue to next loop cause we've found a match
} elseif (strpos(core::$chans[$chan]['users'][$nick], 'o') !== false) {
$remove_access = true;
// set remove access to true
continue 1;
// continue to next loop to check other access records
} else {
continue 1;
// continue to next loop to check other access records
}
// we check if the user has access, if they do break;
// we also check if they dont have access and have op, if they do remove it.
}
// loop through the access records
}
// loop through channels, check if they are in any
}
// check if mode_on_id is set, also cs_access is enabled, and lets do a remote access gain :D
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD);
core::alog(core::$config->nickserv->nick . ': Invalid password from ' . core::get_full_hostname($nick));
// some logging stuff
database::insert('failed_attempts', array('nick' => $nick, 'mask' => core::get_full_hostname($nick), 'time' => core::$network_time));
core::$nicks[$nick]['failed_attempts']++;
// ooh, we have something to log :)
//.........这里部分代码省略.........
示例10: substr
if ($coud['crIQ'] > 0) {
$upd .= ",us.IQ=us.IQ+{$coud['crIQ']}";
$ev .= ", {$coud['crIQ']} IQ";
}
$ev = substr($ev, 1);
if ($upd) {
$db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid {$upd} WHERE u.userid={$userid}");
}
$db->query("INSERT INTO events VALUES('',{$userid},unix_timestamp(),0,'Congratulations, you completed the {$coud['crNAME']} and gained {$ev}!')");
}
$db->query("UPDATE users SET course=0 WHERE cdays=0");
$db->query("TRUNCATE TABLE votes;");
$db->query("UPDATE `businesses` SET `brank` = '100000' WHERE `brank` > '100000'");
$select_businesses = $db->query("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) ORDER BY `busId` ASC");
while ($bs = $db->fetch_row($select_businesses)) {
$amount = $db->num_rows($db->query(sprintf("SELECT * FROM `businesses_members` WHERE `bmembBusiness` = '%u'", $bs['busId'])));
$active = $db->num_rows($db->query(sprintf("SELECT * FROM `users` WHERE `business` = '%u' AND active='%d'", $bs['busId'], 1)));
$new_customers = $bs['brank'] * $active + rand(10, 20) * $bs['classCost'] / 200;
$new_profit = $new_customers + rand(110, 990);
$new_rank = $bs['classId'] * $active / 2;
$db->query(sprintf("UPDATE `businesses` SET `busYCust` = `busCust`, `busYProfit` = `busProfit`, `busCust` = '%d', `busProfit` = '%d', `busCash` = '%d' WHERE `busId` = '%u'", $new_customers, $new_profit, $new_profit + $bs['busCash'], $bs['busId']));
$db->query(sprintf("UPDATE `businesses` SET `busDays` = `busDays` + '1'"));
$db->query(sprintf("UPDATE `users` SET `activedays` = `activedays` + '1' WHERE `active` = '1'"));
$db->query(sprintf("UPDATE `users` SET `active` = '0' WHERE `active` = '1'"));
$db->query(sprintf("UPDATE `businesses` SET `brank` = `brank` + '%d' WHERE `busId` = '%u'", $new_rank, $bs['busId']));
$fetch_members = $db->query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) LEFT JOIN `businesses_ranks` ON (`rankId` = `bmembRank`) WHERE `bmembBusiness` = '%u'", $bs['busId'])) or die('Cron not run');
$db->query("UPDATE userstats SET labour = labour + 50, IQ = IQ + 50, strength = strength + 50 WHERE userid = {$bs['busDirector']}");
$db->query("UPDATE users SET comppoints = comppoints + 1 WHERE userid = {$bs['busDirector']}");
while ($fm = $db->fetch_row($fetch_members)) {
$db->query(sprintf("UPDATE `userstats` SET `{$fm['rankPrim']}` = `{$fm['rankPrim']}` + '%.6f', `{$fm['rankSec']}` = `{$fm['rankSec']}` + '%.6f' WHERE (`userid` = '%u')", $fm['rankPGain'], $fm['rankSGain'], $fm['userid'])) or die('Cron not run');
$db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d' WHERE `userid` = '%u'", $fm['bmembCash'], $fm['userid'])) or die('Cron not run');
示例11: header
$user = User::fbc_getLoggedIn();
$user ? $fb_active_session = $user->fbc_is_session_active() : ($fb_active_session = FALSE);
if ($user) {
//header redirect to a logged in page
header('Location: index.php');
} else {
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_mysql.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$randnum = rand(1, 1000000);
while ($db->num_rows($db->query("SELECT userid FROM users WHERE userid={$randnum}")) > 0) {
$randnum = rand(1, 1000000);
}
$db->query("INSERT INTO users (username, userid, guest, money) VALUES('Guest #{$randnum}', '{$randnum}', 1, 100)");
$_SESSION['loggedin'] = 1;
$_SESSION['loggedin'] = 1;
$_SESSION['userid'] = $randnum;
$thirtyma = time() - 60 * 15;
//thirty minutes ago
$dgaatl = $db->query("SELECT * FROM users WHERE guest=1 AND laston<{$thirtyma} AND userid!={$randnum} LIMIT 3");
while ($dga = $db->fetch_row($dgaatl)) {
$db->query("DELETE FROM arcadepbest WHERE userid={$dga['userid']}");
$db->query("DELETE FROM arcadetrophy WHERE userid={$dga['userid']}");
$db->query("DELETE FROM users WHERE userid={$dga['userid']}");
$db->query("DELETE FROM highscores WHERE userid={$dga['userid']}");
$db->query("DELETE FROM flashscores WHERE userid={$dga['userid']}");
示例12: check_expire
public static function check_expire()
{
if (core::$config->nickserv->expire == 0) {
return false;
}
// skip nicknames if config is set to no expire.
$expiry_time = core::$config->nickserv->expire * 86400;
$check_time = core::$network_time - $expiry_time;
// set up our times.
$nick_q = database::select('users', array('id', 'display', 'last_timestamp'), array('last_timestamp', '!=', '0', 'AND', 'last_timestamp', '<', $check_time));
if (database::num_rows($nick_q) == 0) {
return false;
}
// no expiring nicknames
while ($nick = database::fetch($nick_q)) {
// Mikeh gets most of the credit for helping
// me code this function
database::delete('users', array('display', '=', $nick->display));
database::delete('users_flags', array('nickname', '=', $user->display));
// delete the users record
database::delete('chans_levels', array('target', '=', $nick->display));
// also delete this users channel access.
core::alog(core::$config->nickserv->nick . ': ' . $nick->display . ' has expired. Last used on ' . date('F j, Y, g:i a', $nick->last_timestamp));
// logchan it
if (isset(core::$nicks[$nick->display])) {
ircd::on_user_logout($nick->display);
}
// if the nick is being used unregister it, even though it shouldn't be, just to be safe.
}
// loop through all expiring nicks.
}
示例13: list_command
public static function list_command($nick, $ircdata = array())
{
$term = $ircdata[0];
$limit = $ircdata[1];
$mode = isset($ircdata[2]) ? strtolower($ircdata[2]) : '';
if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_ACCESS_DENIED);
return false;
}
// they've gotta be identified and opered..
if (trim($term) == '' || trim($limit) == '' || isset($mode) && !in_array($mode, array('', 'suspended'))) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'INFO'));
return false;
}
// invalid syntax
if (!preg_match('/([0-9]+)\\-([0-9]+)/i', $limit)) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'LIST'));
return false;
}
// invalid syntax
$total = database::select('chans', array('id'));
$total = database::num_rows($total);
$chans = self::_find_match($term, $mode, $limit);
// try and find a match
if (database::num_rows($chans) == 0) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_BOTTOM, array('num' => 0, 'total' => $total));
return false;
}
// no channels?
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_TOP);
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_TOP2);
// top of the list
while ($channel = database::fetch($chans)) {
$false_chan = $channel->channel;
if (!isset($channel->channel[18])) {
$y = strlen($channel->channel);
for ($i = $y; $i <= 17; $i++) {
$false_chan .= ' ';
}
}
// this is just a bit of fancy fancy, so everything displays neat
if ($channel->suspended == 0) {
$info = chanserv::get_flags($channel->channel, 'd');
} else {
$info = $channel->suspend_reason;
}
// suspend reason, or description?
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_ROW, array('chan' => $false_chan, 'info' => $info));
}
// loop through the channels
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_BOTTOM, array('num' => database::num_rows($chans) == 0 ? 0 : database::num_rows($chans), 'total' => $total));
}
示例14: database
*/
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_mysql.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$value = abs((int) $_GET['v']);
$query = 'SELECT username,user_level,totmoney,signedup,totads,totref,donatordays FROM users WHERE userid = ' . $value;
$e = $db->query($query);
$x = $db->fetch_row($e);
$query2 = 'SELECT totmoney FROM users WHERE totmoney>' . $x['totmoney'];
$en = $db->query($query2);
$rank = $db->num_rows($en);
$rank += 1;
$x['totref'] = number_format($x['totmoney'], 2);
$x['totref'] = " \$" . $x['totref'];
$x['totads'] = number_format($x['totads']);
// Check cache
$cache = 'psigs/' . $value . '.png';
if (file_exists($cache)) {
$delold = unlink($cache);
}
// Load image thing
$im = imagecreatefrompng('images/sig.png');
$font = 'fonts/franklin.ttf';
$color = imagecolorallocate($im, 188, 222, 255);
// Blueish or so
// Write
示例15: array
$c = $db->connection_id;
$set = array();
$settq = $db->query("SELECT * FROM settings");
$IP = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
while ($r = $db->fetch_row($settq)) {
$set[$r['conf_name']] = $r['conf_value'];
}
if ($_POST['email'] == "" || $_POST['password'] == "") {
die("<h3>{$set['game_name']} Error</h3>\nYou did not fill in the login form!<br>\n<a href=login.php>> Back</a>");
}
$_POST['email'] = mysql_real_escape_string($_POST['email']);
$encpass = $crypt->encrypt($_POST['email'], $_POST['password']);
$encpass = addslashes($encpass);
$uq = $db->query("SELECT userid FROM users WHERE email='{$_POST['email']}' AND `userpass`='{$encpass}'");
$la = $db->fetch_row($db->query("SELECT * FROM loginattempts WHERE ip='{$IP}'"));
if ($db->num_rows($uq) == 0 && $la['times'] < 10) {
$lat = $db->num_rows($db->query("SELECT * FROM loginattempts WHERE ip='{$IP}'"));
if (!$lat) {
$db->query("INSERT INTO loginattempts VALUES('','{$IP}',1)");
} else {
$db->query("UPDATE loginattempts SET times=times+1 WHERE ip='{$IP}'");
}
die("<h3>{$set['game_name']} Error</h3>\nInvalid email or password!<br>\n<a href=login.php>> Back</a>");
} else {
if ($la['times'] > 9) {
die("<h3>{$set['game_name']} Error</h3>\nYou have tried to login the maximum number of times for this hour. Please wait 1 hour and try again.<br>\n<a href=login.php>> Back</a>");
} else {
$_SESSION['loggedin'] = 1;
$mem = $db->fetch_row($uq);
$_SESSION['userid'] = $mem['userid'];
$db->query("UPDATE users SET lastip_login='{$IP}',last_login=unix_timestamp() WHERE userid={$mem['userid']}");