本文整理汇总了PHP中database::update方法的典型用法代码示例。如果您正苦于以下问题:PHP database::update方法的具体用法?PHP database::update怎么用?PHP database::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
public static function set($variable, $value)
{
$v = json_encode($value);
if (!self::exists($variable)) {
database::insert("variables", array("variable_name" => $variable, "variable_value" => $v));
} else {
database::update("variables", array("variable_value" => $v), "variable_name='%var'", array("%var" => $variable));
}
}
示例2: update
function update()
{
$this->onUpdate();
if (!$this->validate($errors)) {
return false;
}
$db = new database();
$db->table = $this->__table;
$db->drop($this);
return $db->update();
}
示例3: suspend_command
public static function suspend_command($nick, $ircdata = array())
{
$chan = core::get_chan(&$ircdata, 0);
$reason = core::get_data_after(&$ircdata, 1);
$chan_info = array();
// get the channel.
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 ($chan == '' || $chan[0] != '#') {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'SUSPEND'));
return false;
// wrong syntax
}
// make sure they've entered a channel
if (trim($reason) == '') {
$reason = 'No reason';
}
// is there a reason? if not we set it to 'No Reason'
if ($channel = services::chan_exists($chan, array('channel', 'suspended'))) {
if ($channel->suspended == 1) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_2, array('chan' => $chan));
return false;
// channel is already suspended lol
} else {
database::update('chans', array('suspended' => 1, 'suspend_reason' => $reason), array('channel', '=', $channel->channel));
// channel isn't suspended, but it IS registered
}
} else {
$chan_info = array('channel' => $chan, 'timestamp' => core::$network_time, 'last_timestamp' => core::$network_time, 'suspended' => 1, 'suspend_reason' => $reason);
database::insert('chans', $chan_info);
database::insert('chans_flags', array('channel' => $chan, 'flags' => 'd', 'desc' => $reason));
// if the channel isn't registered, we register it, with a founder value of 0
// so we can check when it's unsuspended THAT if the founder value is 0, we'll
// just drop it as well, this way nobody actually gets the founder status.
}
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_3, array('chan' => $chan, 'reason' => $reason));
core::alog(core::$config->chanserv->nick . ': ' . $nick . ' SUSPENDED ' . $chan . ' with the reason: ' . $reason);
ircd::globops(core::$config->chanserv->nick, $nick . ' SUSPENDED ' . $chan);
if (!empty(core::$chans[$chan]['users'])) {
foreach (core::$chans[$chan]['users'] as $user => $boolean) {
if (!core::$nicks[$nick]['ircop']) {
ircd::kick(core::$config->chanserv->nick, $user, $chan, $reason);
}
}
}
// any users in the channel? KICK EM!! RAWR
}
示例4: logout_command
public static function logout_command($nick, $ircdata = array())
{
// no parameter commands ftw.
if ($user = services::user_exists($nick, false, array('display', 'id', 'identified', 'vhost'))) {
if ($user->identified == 1) {
ircd::on_user_logout($nick);
// here we set unregistered mode
database::update('users', array('identified' => 0, 'last_timestamp' => core::$network_time), array('display', '=', $nick));
// unidentify them
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LOGGED_OUT);
// let them know
core::alog(core::$config->nickserv->nick . ': ' . core::get_full_hostname($nick) . ' logged out of ' . core::$nicks[$nick]['nick']);
// and log it.
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NOT_IDENTIFIED);
// not even identified
}
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_UNREGISTERED);
// unregistered nick name
}
}
示例5: database
<?php
session_start();
include "../lib/server-config.php";
require "../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
//Checking parameter
if (isset($_GET['an']) && isset($_GET['part']) && isset($_GET['to'])) {
if ($_GET['part'] == 'account') {
$strSQL = "UPDATE " . substr(strtolower($tbf), 0, -2) . "useraccount SET status = '" . $_GET['to'] . "' WHERE username = '" . $_GET['an'] . "'";
$resultUpdate = $db->update($strSQL);
$db->disconnect();
?>
<script>
alert('Activate success!');
window.history.back();
</script>
<?php
exit;
} else {
if ($_GET['part'] == 'institute') {
$strSQL = "UPDATE " . substr(strtolower($tbf), 0, -2) . "institute SET institute_status = '" . $_GET['to'] . "' WHERE institute_id = '" . $_GET['an'] . "'";
$resultUpdate = $db->update($strSQL);
$db->disconnect();
?>
<script>
alert('Activate success!');
window.history.back();
</script>
<?php
示例6: unsuspend_command
public static function unsuspend_command($nick, $ircdata = array())
{
$unick = core::get_nick(&$ircdata, 0);
// get the nick etc.
if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// they've gotta be identified and opered..
if ($user = services::user_exists($unick, false, array('display', 'suspended', 'real_user'))) {
if ($user->suspended == 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_4, array('nick' => $unick));
return false;
}
// nick isn't suspended
database::update('users', array('suspended' => 0, 'suspend_reason' => null), array('display', '=', $unick));
if ($user->real_user == 0) {
database::delete('users', array('display', '=', $unick));
}
// nick wasen't registered by a real person, drop it
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_4, array('nick' => $unick));
return false;
}
// nick isn't even registered.
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_5, array('nick' => $unick));
core::alog(core::$config->nickserv->nick . ': ' . $nick . ' UNSUSPENDED ' . $unick);
ircd::globops(core::$config->nickserv->nick, $nick . ' UNSUSPENDED ' . $unick);
// oh well, was fun while it lasted eh?
// unsuspend it :P
}
示例7: explode
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$pay_date_explode = explode("/", trim($_POST['pay_date']));
$pay_date = $pay_date_explode[2] . "-" . $pay_date_explode[1] . "-" . $pay_date_explode[0] . " " . trim($_POST['pay_time']);
$db = new database();
$value_pm = array("pay_money" => trim($_POST['pay_money']), "pay_date" => $pay_date, "detail" => trim($_POST['detail']), "order_id" => $_POST['order_id']);
$query_pm = $db->insert("payments", $value_pm);
if ($query_pm == TRUE) {
$db->update("orders", array("order_status" => "payments"), "id='{$_POST['order_id']}'");
header("location:" . $baseUrl . "/back/order");
}
mysql_close();
}
示例8: 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
}
示例9: update
public function update()
{
//udate the fax
//get the dialplan uuid
$database = new database();
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$result = $database->find();
foreach ($result as $row) {
$this->dialplan_uuid = $row['dialplan_uuid'];
}
//if the extension number is empty and the dialplan exists then delete the dialplan
if (strlen($this->fax_extension) == 0) {
if (strlen($this->dialplan_uuid) > 0) {
//delete dialplan entry
$database = new database();
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete the child dialplan information
$database = new database();
$database->table = "v_dialplans";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//update the table to remove the dialplan_uuid
$this->dialplan_uuid = '';
}
}
//update the fax
$fax_uuid = uuid();
$database = new database();
$database->table = "v_fax";
$database->fields['fax_uuid'] = $this->fax_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['fax_name'] = $this->fax_name;
$database->fields['fax_extension'] = $this->fax_extension;
$database->fields['fax_email'] = $this->fax_email;
$database->fields['fax_pin_number'] = $this->fax_pin_number;
$database->fields['fax_caller_id_name'] = $this->fax_caller_id_name;
$database->fields['fax_caller_id_number'] = $this->fax_caller_id_number;
$database->fields['fax_forward_number'] = $this->fax_forward_number;
$database->fields['fax_user_list'] = $this->fax_user_list;
$database->fields['fax_description'] = $this->fax_description;
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$database->update();
if (strlen($this->fax_extension) > 0) {
//update the dialplan
$database = new database();
$database->table = "v_dialplans";
$database->fields['dialplan_name'] = $this->fax_name;
$database->fields['dialplan_order'] = '333';
$database->fields['dialplan_context'] = $this->context;
$database->fields['dialplan_enabled'] = $this->fax_enabled;
$database->fields['dialplan_description'] = $this->dialplan_description;
$database->fields['app_uuid'] = $this->app_uuid;
if ($this->dialplan_uuid) {
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->update();
} else {
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->add();
}
//delete the old dialplan details to prepare for new details
$database = new database();
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//add the dialplan details
//.........这里部分代码省略.........
示例10: database
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$db = new database();
$value_py = array("detail" => trim($_POST['detail']), "created" => date('Y-m-d H:i:s'));
$query_py = $db->update("contents", $value_py, "codename='howtopay'");
if ($query_py == TRUE) {
$_SESSION[_ss . 'msg_result'] = TRUE;
header("location:" . $baseUrl . "/back/howtopay");
}
mysql_close();
}
示例11: update
public function update()
{
/* UPDATE multiple tables:
// UPDATE tables SET table1.col1=table2.col2
// WHERE condition;
// needs:
// 1. column names - $this->cols
// 2. table name - $this->table_name
// 3. id - $_GET['id'] from action form
example:
$sql = " UPDATE {$this->table_name} SET
nom=?, prenom=?, nom_khmer=?, prenom_khmer=?, sex_id=?, matricule=?, dob=?, program_id=?
WHERE student_id=?";
/********************************************/
$security_handler = new security();
$security_handler->check_token();
$id = $_GET['id'];
$i = 0;
$cols = '';
$values = array();
foreach ($this->cols as $column) {
array_push($values, $_POST[$column]);
$cols .= $column . '=?,';
$i++;
}
array_push($values, $id);
// add last value to the array, which corresponds to the record id number.
$cols = substr($cols, 0, -1);
$sql = "UPDATE " . $this->table_name . " SET " . $cols . " WHERE " . $this->id_column . "=?";
//echo "<p>sql: ".$sql."<br>";
//echo "<p>values: ";
//var_dump ($values);
$connection = new database();
if ($connection->update($sql, $values)) {
$_SESSION['log'] .= new timestamp("Affected rows: " . $connection->get_row_num());
} else {
$_SESSION['log'] .= new timestamp("Record was not updated in {$_GET['controller']}!");
}
//die();
}
示例12: _registered_nick
public static function _registered_nick($nick, $user)
{
database::update('users', array('identified' => 0), array('display', '=', $nick));
// set them to identified 0, this might fix that long term bug.
ircd::on_user_logout($nick);
// they shouldn't really have registered mode
if (is_array(nickserv::$help->NS_REGISTERED_NICK)) {
foreach (nickserv::$help->NS_REGISTERED_NICK as $line) {
services::communicate(core::$config->nickserv->nick, $nick, $line);
}
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_REGISTERED_NICK);
}
// this is just a crappy function, basically just parses the NS_REGISTERED thing
// we check for arrays and single lines, even though the default is array
// someone might have changed it.
if (nickserv::check_flags($nick, array('S')) && isset(modules::$list['ns_flags'])) {
timer::add(array('ns_identify', 'secured_callback', array($nick)), core::$config->nickserv->secure_time, 1);
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SECURED_NICK, array('seconds' => core::$config->nickserv->secure_time));
}
// if the nickname has secure enabled, we let them know that we're watching them :o
}
示例13: updateData
public function updateData($data, $id)
{
$database = new database();
$data['updated_at'] = date('Y-m-d H:i:s');
$conditions['id'] = $id;
return $database->update('trolls', $data, $conditions);
}
示例14: sapass_command
public static function sapass_command($nick, $ircdata = array())
{
$unick = core::get_nick(&$ircdata, 0);
$new_pass = $ircdata[1];
$conf_pass = $ircdata[2];
// new password.
if (!($user = services::user_exists($unick, false, array('display', 'id', 'identified', 'salt')))) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick));
return false;
}
// find out if our user is registered
if (services::is_root($unick) && !services::is_root($nick)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// is a non-root trying to change a root's password?
if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// do we have access to do this?
if (strtolower($new_pass) == strtolower($unick)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_PASSWORD_NICK_U);
return false;
}
// are they using a reasonable password, eg. != their nick, lol.
if ($new_pass != $conf_pass) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_PASSWORD_DIFF);
return false;
}
// the passwords are different
database::update('users', array('pass' => sha1($new_pass . $user->salt)), array('display', '=', $unick));
// we update the password here, with the users salt.
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NEW_PASSWORD_U, array('nick' => $unick, 'pass' => $new_pass));
// let them know
core::alog(core::$config->nickserv->nick . ': ' . core::get_full_hostname($nick) . ' changed the password for ' . $unick);
// logchan
}
示例15: main
//.........这里部分代码省略.........
ircd::mode(core::$config->chanserv->nick, $chan, '+v ' . $ircdata[4]);
} else {
ircd::mode(core::$config->chanserv->nick, $chan, '+v ' . $nick);
}
// check if another param is specified
}
// !voice command
if (commands::on_fantasy_cmd(&$ircdata, 'devoice', core::$config->chanserv->nick)) {
if (chanserv::check_levels($nick, $channel->channel, array('v', 'h', 'o', 'a', 'q', 'f', 'F')) === false) {
return false;
}
if (strpos($ircdata[4], ':') !== false) {
mode::type_check($chan, $ircdata[4], '-v', core::$config->chanserv->nick);
} elseif (isset($ircdata[4])) {
ircd::mode(core::$config->chanserv->nick, $chan, '-v ' . $ircdata[4]);
} else {
ircd::mode(core::$config->chanserv->nick, $chan, '-v ' . $nick);
}
// check if another param is specified
}
// !devoice command
if (commands::on_fantasy_cmd(&$ircdata, 'topic', core::$config->chanserv->nick)) {
if (chanserv::check_levels($nick, $channel->channel, array('t', 'F')) === false) {
return false;
}
if (isset($ircdata[4])) {
$topicmask = chanserv::get_flags($chan, 't');
// get the topicmask
if ($topicmask != null) {
$new_topic = core::get_data_after(&$ircdata, 4);
$new_topic = str_replace(' *', ' ' . $new_topic, $topicmask);
$new_topic = str_replace('\\*', '*', $new_topic);
ircd::topic(core::$config->chanserv->nick, $channel->channel, $new_topic);
database::update('chans', array('topic' => $new_topic, 'topic_setter' => core::$config->chanserv->nick), array('channel', '=', $channel->channel));
} else {
$new_topic = trim(core::get_data_after(&$ircdata, 4));
ircd::topic(core::$config->chanserv->nick, $channel->channel, $new_topic);
database::update('chans', array('topic' => $new_topic, 'topic_setter' => core::$config->chanserv->nick), array('channel', '=', $channel->channel));
}
// if there isnt, just set it normally.
}
// make sure there is another mask x]
}
// !topic command
if (commands::on_fantasy_cmd(&$ircdata, 'mode', core::$config->chanserv->nick) || commands::on_fantasy_cmd(&$ircdata, 'm', core::$config->chanserv->nick)) {
if (chanserv::check_levels($nick, $channel->channel, array('h', 'o', 'a', 'q', 'F')) === false) {
return false;
}
if (isset($ircdata[4])) {
$mode_queue = core::get_data_after(&$ircdata, 4);
// get the mode queue
if (!core::$nicks[$nick]['ircop']) {
$mode_queue[0] = str_replace('O', '', $mode_queue[0]);
}
// don't let them MODE +O if they're not an IRCop
ircd::mode(core::$config->chanserv->nick, $chan, $mode_queue);
// check if there are any other parameters in the !mode command
}
// are we even setting a mode?
}
// !mode command
if (commands::on_fantasy_cmd(&$ircdata, 'kick', core::$config->chanserv->nick)) {
if (chanserv::check_levels($nick, $channel->channel, array('r', 'F')) === false) {
return false;
}
// ignore if the nick doesn't have access to perform this