本文整理汇总了PHP中updatetable函数的典型用法代码示例。如果您正苦于以下问题:PHP updatetable函数的具体用法?PHP updatetable怎么用?PHP updatetable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了updatetable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auth_update
function auth_update($set, $where)
{
$set = base_protect($set);
$where = base_protect($where);
$flag = updatetable('authmap', $set, $where);
return $flag;
}
示例2: update
function update($uId, $appIds, $appName, $privacy, $allowSideNav, $allowFeed, $allowProfileLink, $version, $displayMethod, $displayOrder = null)
{
global $_SGLOBAL;
switch ($privacy) {
case 'public':
$privacy = 0;
break;
case 'friends':
$privacy = 1;
break;
case 'me':
$privacy = 3;
break;
case 'none':
$privacy = 5;
break;
default:
$privacy = 0;
}
$where = sprintf('uid = %d AND appid IN (%s)', $uId, simplode($appIds));
$setarr = array('appname' => $appName, 'privacy' => $privacy, 'allowsidenav' => $allowSideNav, 'allowfeed' => $allowFeed, 'allowprofilelink' => $allowProfileLink);
if ($displayOrder !== null) {
$setarr['displayorder'] = $displayOrder;
}
updatetable('userapp', $setarr, $where);
$result = $_SGLOBAL['db']->affected_rows();
$displayMethod = $displayMethod == 'iframe' ? 1 : 0;
if (is_array($appIds)) {
foreach ($appIds as $appId) {
$this->refreshApplication($appId, $appName, $version, $displayMethod, null, null, null);
}
}
return new APIResponse($result);
}
示例3: setActionLink
function setActionLink($uId, $appId, $actionMarkup)
{
global $_SGLOBAL;
$fields = array('profilelink' => $actionMarkup);
$where = array('uid' => $uId, 'appid' => $appId);
updatetable('userappfield', $fields, $where);
$result = $_SGLOBAL['db']->affected_rows();
return new APIResponse($result);
}
示例4: update
function update($appId, $appName, $version, $displayMethod, $displayOrder = null)
{
$fields = array('appname' => $appName);
$where = array('appid' => $appId);
$result = updatetable('userapp', $fields, $where);
$displayMethod = $displayMethod == 'iframe' ? 1 : 0;
$this->refreshApplication($appId, $appName, $version, $displayMethod, null, null, $displayOrder);
return new APIResponse($result);
}
示例5: edit
/**
* 编辑指定ID信息
*
* @param unknown_type $eid
* @return unknown
*/
function edit($eid, $dataarray)
{
if (is_array($dataarray) && !empty($eid)) {
//更新数据库操作
$wheresqlarr = " " . $this->idname . "='{$eid}'";
updatetable($this->table, $dataarray, $wheresqlarr);
return "OK";
}
return lang('Array_format_error');
}
示例6: update
public function update($appId, $appName, $version, $displayMethod, $displayOrder = null)
{
$db_prefix = getDbPrefix();
global $_SGLOBAL;
$fields = array('appname' => $appName);
$where = array('appid' => $appId);
$result = updatetable('myop_myapp', $fields, $where);
$result = updatetable('myop_userapp', $fields, $where) || $result;
$displayMethod = $displayMethod == 'iframe' ? 1 : 0;
$this->refreshApplication($appId, $appName, $version, $displayMethod, null, null, $displayOrder);
return new APIResponse($result);
}
示例7: update
function update($appId, $appName, $version, $displayMethod, $displayOrder = null) {
global $_SGLOBAL;
$fields = array('appname' => $appName);
$where = array('appid' => $appId);
updatetable('myapp', $fields, $where);
updatetable('userapp', $fields, $where);
$result = $_SGLOBAL['db']->affected_rows();
$displayMethod = ($displayMethod == 'iframe') ? 1 : 0;
$this->refreshApplication($appId, $appName, $version, $displayMethod, null, null, $displayOrder);
return new APIResponse($result);
}
示例8: update_doing
function update_doing($db_uch, $uid, $uname, $msg)
{
$mtime = explode(' ', microtime());
$doingarr = array("uid" => $uid, "username" => $uname, "dateline" => $mtime[1], "message" => $msg, "ip" => "IM");
inserttable($db_uch, "doing", $doingarr, 1);
updatetable($db_uch, "spacefield", array("note" => $uname), array("uid" => $uid));
$feedarr = array("appid" => 1, "icon" => "doing", "uid" => $uid, "username" => $uname, "dateline" => $mtime[1], "title_template" => "{actor}:{message}", "body_template" => "", "body_general" => "", "image_1" => "", "image_1_link" => "", "image_2" => "", "image_2_link" => "", "image_3" => "", "image_3_link" => "", "image_4" => "", "image_4_link" => "", "target_ids" => "", "friend" => "");
$feedarr = sstripslashes($feedarr);
$feedarr['title_data'] = serialize(sstripslashes(array("message" => $msg)));
$feedarr['body_data'] = serialize(sstripslashes(array()));
$feedarr['hash_template'] = md5($feedarr['title_template'] . "\t" . $feedarr['body_template']);
$feedarr['hash_data'] = md5($feedarr['title_template'] . "\t" . $feedarr['title_data'] . "\t" . $feedarr['body_template'] . "\t" . $feedarr['body_data']);
$feedarr = sstripslashes($feedarr);
inserttable($db_uch, "feed", $feedarr);
}
示例9: auth
function auth($uId, $picData, $picExt = 'jpg', $isReward = false)
{
global $_SGLOBAL;
$pic = base64_decode($picData);
if (!$pic || strlen($pic) == strlen($picData)) {
$errCode = '200';
$errMessage = 'Error argument';
return new APIErrorResponse($errCode, $errMessage);
}
$secret = md5($_SGLOBAL['timestamp'] . "\t" . $_SGLOBAL['supe_uid']);
$picDir = S_ROOT . './data/avatar/' . substr($secret, 0, 1);
if (!is_dir($picDir)) {
if (!mkdir($picDir, 0777)) {
$errCode = '300';
$errMessage = 'Cannot create directory';
return new APIErrorResponse($errCode, $errMessage);
}
}
$picDir .= '/' . substr($secret, 1, 1);
if (!is_dir($picDir)) {
if (!@mkdir($picDir, 0777)) {
$errCode = '300';
$errMessage = 'Cannot create directory';
return new APIErrorResponse($errCode, $errMessage);
}
}
$picPath = $picDir . '/' . $secret . '.' . $picExt;
$fp = @fopen($picPath, 'wb');
if ($fp) {
if (fwrite($fp, $pic) !== FALSE) {
fclose($fp);
//The main table
updatetable('space', array('videostatus' => 1), array('uid' => $uId));
//Attached table
$fields = array('videopic' => $secret);
updatetable('spacefield', $fields, array('uid' => $uId));
$result = $_SGLOBAL['db']->affected_rows();
if ($isReward) {
// Bonus Points
getreward('videophoto', 1, $uId, '', 0);
}
return new APIResponse($result);
}
}
$errCode = '300';
$errMessage = 'Video Auth Error';
return new APIErrorResponse($errCode, $errMessage);
}
示例10: insertsession
function insertsession($setarr)
{
global $_SGLOBAL, $_SCONFIG;
$_SCONFIG['onlinehold'] = intval($_SCONFIG['onlinehold']);
if ($_SCONFIG['onlinehold'] < 300) {
$_SCONFIG['onlinehold'] = 300;
}
$_SGLOBAL['db']->query("DELETE FROM " . tname('session') . " WHERE uid='{$setarr['uid']}' OR lastactivity<'" . ($_SGLOBAL['timestamp'] - $_SCONFIG['onlinehold']) . "'");
//添加在线
$ip = getonlineip(1);
$setarr['lastactivity'] = $_SGLOBAL['timestamp'];
$setarr['ip'] = $ip;
inserttable('session', $setarr, 0, true, 1);
//更新用户
updatetable('space', array('lastlogin' => $_SGLOBAL['timestamp'], 'ip' => $ip), array('uid' => $setarr['uid']), 1);
}
示例11: update
function update($appId, $appName, $version, $displayMethod, $displayOrder = null)
{
global $_SGLOBAL;
$result = true;
$sql = "SELECT appname FROM " . tname('myapp') . " WHERE appid = {$appId}";
$query = $_SGLOBAL['db']->query($sql);
$row = $_SGLOBAL['db']->fetch_array($query);
if ($row['appname'] != $appName) {
$fields = array('appname' => $appName);
$where = array('appid' => $appId);
updatetable('myapp', $fields, $where);
updatetable('userapp', $fields, $where);
$result = $_SGLOBAL['db']->affected_rows();
}
$displayMethod = $displayMethod == 'iframe' ? 1 : 0;
$this->refreshApplication($appId, $appName, $version, $displayMethod, null, null, $displayOrder);
return new APIResponse($result);
}
示例12: find_pwd
/**
@param (忘记密码)通过地址栏用户名和新密码登陆
@param return null
*/
function find_pwd()
{
global $_MooClass, $dbTablePre, $userid, $_MooCookie;
// if($userid){
// return;
// }
$uid = MooGetGPC('uid', 'string', G);
$pwd = MooGetGPC('upwd', 'string', G);
/* echo md5($uid).'<br>';
echo md5($pwd);
print_r($_COOKIE);
exit;
*/
if ($_MooCookie['findpwd'] == md5($pwd) && md5($uid) == $_MooCookie['finduser']) {
$newpwd = md5(base64_decode($pwd));
//note 修改密码
//$_MooClass['MooMySQL']->query("update {$dbTablePre}members set password = '{$newpwd}' where uid = '{$uid}'");
//if(MOOPHP_ALLOW_FASTDB){
// MooFastdbUpdate('members','uid',$uid);
// }
MooSetCookie('auth', MooAuthCode("{$uid}\t{$newpwd}", 'ENCODE'), 86400);
//note 写入session表需要的字段值
$online_ip = GetIP();
$lastactive = $GLOBALS['timestamp'];
//$uid = $user['uid'];
//note 更新用户的最近登录ip和最近登录时间
$updatesqlarr = array('lastip' => $online_ip, 'lastvisit' => $lastactive, 'password' => $newpwd);
$wheresqlarr = array('uid' => $uid);
updatetable("members_search", $updatesqlarr, $wheresqlarr);
if (MOOPHP_ALLOW_FASTDB) {
$val = array();
$val['lastip'] = $online_ip;
$val['lastvisit'] = $lastactive;
$val['password'] = $newpwd;
MooFastdbUpdate('members_search', 'uid', $uid, $val);
//!!
}
//note 先删除表里面已存在对应用户的session
//$_MooClass['MooMySQL']->query("DELETE FROM `{$dbTablePre}membersession` WHERE `uid` ='$uid'");
//$_MooClass['MooMySQL']->query("REPLACE INTO `{$dbTablePre}membersession` SET `username`= '$user[username]',`password`='$user[password]',`ip` = '$online_ip',`lastactive` = '$lastactive',`uid` = '$uid'");
return 1;
}
return 0;
}
示例13: wz_checkauth
function wz_checkauth($wxid, $token, $mid, $op_wxid)
{
global $_SGLOBAL;
if ($_COOKIE['site_auth']) {
@(list($password, $token_id) = explode(" ", authcode($_COOKIE['site_auth'], 'DECODE')));
$_SGLOBAL['supe_token_id'] = intval($token_id);
if ($password && $_SGLOBAL['supe_token_id']) {
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("wz_session") . " WHERE token_id=" . $_SGLOBAL['supe_token_id']);
if ($session = $_SGLOBAL['db']->fetch_array($query)) {
if ($session['password'] == $password) {
$token_mid = $_SGLOBAL['db']->getone('select mid from ' . tname('wz_token') . ' where id=' . $_SGLOBAL['supe_token_id']);
$token_op_wxid = $_SGLOBAL['db']->getone('select op_wxid from ' . tname('wz_token') . ' where id=' . $_SGLOBAL['supe_token_id']);
if ($token_mid == $mid && $token_op_wxid == $op_wxid) {
updatetable(tname('wz_token'), array('state' => 1), array('wxid' => $session['wxid'], 'mid' => $mid, 'op_wxid' => $op_wxid));
$_SGLOBAL['supe_wxid'] = addslashes($session['wxid']);
wz_insertsession($session);
//更新session
return $_SGLOBAL['supe_token_id'];
}
}
}
}
}
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("wz_token") . " WHERE wxid='" . $wxid . "' and mid=" . $mid . " and op_wxid=" . $op_wxid . " and state=0");
if ($wz = $_SGLOBAL['db']->fetch_array($query)) {
if ($wz['token'] == $token) {
updatetable(tname('wz_token'), array('state' => 1), array('wxid' => $wxid, 'mid' => $mid, 'op_wxid' => $op_wxid));
$_SGLOBAL['supe_wxid'] = addslashes($wz['wxid']);
$session = array('token_id' => $wz['id'], 'wxid' => $_SGLOBAL['supe_wxid'], 'password' => $token);
wz_insertsession($session);
//登录
$cookietime = 3600;
//3600 * 24 * 15;
//设置cookie
ssetcookie('site_auth', authcode($session["password"] . ' ' . $session["token_id"], 'ENCODE'), $cookietime);
$_SGLOBAL['supe_token_id'] = $session['token_id'];
return $_SGLOBAL['supe_token_id'];
}
}
obclean();
ssetcookie('site_auth', '', -86400 * 365);
return 0;
}
示例14: space_friend_stat
function space_friend_stat($start, $perpage)
{
global $_SGLOBAL;
$next = false;
$query = $_SGLOBAL['db']->query("SELECT uid, friend FROM " . tname('spacefield') . " LIMIT {$start},{$perpage}");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$next = true;
$fuids = array();
$subquery = $_SGLOBAL['db']->query("SELECT fuid FROM " . tname('friend') . " WHERE uid='{$value['uid']}' AND status='1'");
while ($subvalue = $_SGLOBAL['db']->fetch_array($subquery)) {
$fuids[$subvalue['fuid']] = $subvalue['fuid'];
}
$fuidstr = implode(',', $fuids);
if ($fuidstr != $value['friend']) {
updatetable('spacefield', array('friend' => $fuidstr), array('uid' => $value['uid']));
}
}
return $next;
}
示例15: refreshApplication
function refreshApplication($appId, $appName, $version, $displayMethod, $narrow, $flag, $displayOrder)
{
global $_SGLOBAL;
$fields = array();
if ($appName !== null && strlen($appName) > 1) {
$fields['appname'] = $appName;
}
if ($version !== null) {
$fields['version'] = $version;
}
if ($displayMethod !== null) {
// todo: remove
$fields['displaymethod'] = $displayMethod;
}
if ($narrow !== null) {
$fields['narrow'] = $narrow;
}
if ($flag !== null) {
$fields['flag'] = $flag;
}
if ($displayOrder !== null) {
$fields['displayorder'] = $displayOrder;
}
$sql = sprintf('SELECT * FROM %s WHERE appid = %d', tname('myapp'), $appId);
$query = $_SGLOBAL['db']->query($sql);
if ($application = $_SGLOBAL['db']->fetch_array($query)) {
$where = sprintf('appid = %d', $appId);
updatetable('myapp', $fields, $where);
} else {
$fields['appid'] = $appId;
$result = inserttable('myapp', $fields, 1);
}
//update cache
include_once S_ROOT . './source/function_cache.php';
userapp_cache();
}