本文整理汇总了PHP中dsetcookie函数的典型用法代码示例。如果您正苦于以下问题:PHP dsetcookie函数的具体用法?PHP dsetcookie怎么用?PHP dsetcookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dsetcookie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updategroupcreditlog
function updategroupcreditlog($fid, $uid)
{
global $_G;
if (empty($fid) || empty($uid)) {
return false;
}
$today = date('Ymd', TIMESTAMP);
$updategroupcredit = getcookie('groupcredit_' . $fid);
if ($updategroupcredit < $today) {
$status = DB::result_first("SELECT logdate FROM " . DB::table('forum_groupcreditslog') . " WHERE fid='{$fid}' AND uid='{$uid}' AND logdate='{$today}'");
if (empty($status)) {
DB::query("UPDATE " . DB::table('forum_forum') . " SET commoncredits=commoncredits+1 WHERE fid='{$fid}'");
DB::query("REPLACE INTO " . DB::table('forum_groupcreditslog') . " (fid, uid, logdate) VALUES ('{$fid}', '{$uid}', '{$today}')");
if (empty($_G['forum']) || empty($_G['forum']['level'])) {
$forum = DB::fetch_first("SELECT name, level, commoncredits FROM " . DB::table('forum_forum') . " WHERE fid='{$fid}'");
} else {
$_G['forum']['commoncredits']++;
$forum =& $_G['forum'];
}
if (empty($_G['grouplevels'])) {
loadcache('grouplevels');
}
$grouplevel = $_G['grouplevels'][$forum['level']];
if ($grouplevel['type'] == 'default' && !($forum['commoncredits'] >= $grouplevel['creditshigher'] && $forum['commoncredits'] < $grouplevel['creditslower'])) {
$levelid = DB::result_first("SELECT levelid FROM " . DB::table('forum_grouplevel') . " WHERE type='default' AND creditshigher<='{$forum['commoncredits']}' AND creditslower>'{$forum['commoncredits']}' LIMIT 1");
if (!empty($levelid)) {
DB::query("UPDATE " . DB::table('forum_forum') . " SET level='{$levelid}' WHERE fid='{$fid}'");
$groupfounderuid = DB::result_first("SELECT founderuid FROM " . DB::table('forum_forumfield') . " WHERE fid='{$fid}' LIMIT 1");
notification_add($groupfounderuid, 'system', 'grouplevel_update', array('groupname' => '<a href="forum.php?mod=group&fid=' . $fid . '">' . $forum['name'] . '</a>', 'newlevel' => $_G['grouplevels'][$levelid]['leveltitle']));
}
}
}
dsetcookie('groupcredit_' . $fid, $today, 86400);
}
}
示例2: global_footer
function global_footer()
{
global $_G;
if (!$this->allow) {
return;
}
require_once DISCUZ_ROOT . './source/plugin/smstong/smstong.func.php';
$data = DB::fetch_first("SELECT mobile FROM " . DB::table("common_member_profile") . " WHERE uid = {$_G['uid']}");
if ($_G['cache']['plugin']['smstong']['reportmsgnotify'] && $_G['gp_mod'] == 'report' && $_G['gp_reportsubmit']) {
$content = $_G['cache']['plugin']['smstong']['reportmsgnotifymsg'];
$rp = array('$username', '$tid', '$message');
$sm = array($_G['username'], $_G['gp_rid'], $_G['gp_message']);
$content = str_replace($rp, $sm, $content);
$arraymobile = explode(',', $_G['cache']['plugin']['smstong']['reportmsgnotifymobile']);
foreach ($arraymobile as $mobile) {
$ret = sendsms($_G['cache']['plugin']['smstong']['smsusername'], $_G['cache']['plugin']['smstong']['smspassword'], $mobile, $content);
}
} elseif ($_G['cache']['plugin']['smstong']['loggingmsgnotify'] && ismobile($data['mobile']) && $_G['cookie']['loginmark'] != $_G['cookie']['lastvisit']) {
dsetcookie('loginmark', $_G['cookie']['lastvisit']);
require_once DISCUZ_ROOT . './source/function/function_misc.php';
$content = $_G['cache']['plugin']['smstong']['loggingmsgnotifymsg'];
$rp = array('$username', '$logtime', '$ipaddress', '$location');
$sm = array($_G['username'], date('Y-m-d H:i:s', TIMESTAMP), $_G['clientip'], str_replace('-', '', str_replace(' ', '', convertip($_G['clientip']))));
$content = str_replace($rp, $sm, $content);
$ret = sendsms($_G['cache']['plugin']['smstong']['smsusername'], $_G['cache']['plugin']['smstong']['smspassword'], $data['mobile'], $content);
}
}
示例3: cloudaddons_removelog
function cloudaddons_removelog($rid)
{
global $_G;
$reason = $_G['cookie']['uninstallreason'];
dsetcookie('uninstallreason', '', -1);
cloudaddons_open('&mod=app&ac=removelog&rid=' . $rid . '&reason=' . $reason);
}
示例4: common_base
function common_base()
{
global $_G;
if (!isset($_G['connect'])) {
$_G['connect']['url'] = 'http://connect.discuz.qq.com';
$_G['connect']['api_url'] = 'http://api.discuz.qq.com';
$_G['connect']['avatar_url'] = 'http://avatar.connect.discuz.qq.com';
$_G['connect']['qzone_public_share_url'] = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey';
$_G['connect']['referer'] = !$_G['inajax'] && CURSCRIPT != 'member' ? $_G['basefilename'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '') : dreferer();
$_G['connect']['weibo_public_appkey'] = 'ce7fb946290e4109bdc9175108b6db3a';
$_G['connect']['login_url'] = $_G['siteurl'] . 'connect.php?mod=login&op=init&referer=' . urlencode($_G['connect']['referer'] ? $_G['connect']['referer'] : 'index.php');
$_G['connect']['callback_url'] = $_G['siteurl'] . 'connect.php?mod=login&op=callback';
$_G['connect']['discuz_new_feed_url'] = $_G['siteurl'] . 'connect.php?mod=feed&op=new';
$_G['connect']['discuz_remove_feed_url'] = $_G['siteurl'] . 'connect.php?mod=feed&op=remove';
$_G['connect']['discuz_new_share_url'] = $_G['siteurl'] . 'connect.php?mod=share&op=new';
$_G['connect']['discuz_new_share_url'] = $_G['siteurl'] . 'home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp&pluginop=new';
$_G['connect']['discuz_change_qq_url'] = $_G['siteurl'] . 'connect.php?mod=login&op=change';
$_G['connect']['auth_fields'] = array('is_user_info' => 1, 'is_feed' => 2);
if ($_G['uid']) {
dsetcookie('connect_is_bind', $_G['member']['conisbind'], 31536000);
if (!$_G['member']['conisbind'] && $_G['cookie']['connect_login']) {
$_G['cookie']['connect_login'] = 0;
dsetcookie('connect_login');
}
}
if (!$_G['uid'] && !defined('IN_MOBILE')) {
$_G['setting']['pluginhooks']['global_login_text'] = tpl_login_bar();
}
}
}
示例5: viewthread_updateviews
function viewthread_updateviews($tableid)
{
global $_G;
if (!$_G['setting']['preventrefresh'] || $_G['cookie']['viewid'] != 'tid_' . $_G['tid']) {
if (!$tableid && $_G['setting']['optimizeviews']) {
if ($_G['forum_thread']['addviews']) {
if ($_G['forum_thread']['addviews'] < 100) {
C::t('forum_threadaddviews')->update_by_tid($_G['tid']);
} else {
if (!discuz_process::islocked('update_thread_view')) {
$row = C::t('forum_threadaddviews')->fetch($_G['tid']);
C::t('forum_threadaddviews')->update($_G['tid'], array('addviews' => 0));
C::t('forum_thread')->increase($_G['tid'], array('views' => $row['addviews'] + 1), true);
discuz_process::unlock('update_thread_view');
}
}
} else {
C::t('forum_threadaddviews')->insert(array('tid' => $_G['tid'], 'addviews' => 1), false, true);
}
} else {
C::t('forum_thread')->increase($_G['tid'], array('views' => 1), true, $tableid);
}
}
dsetcookie('viewid', 'tid_' . $_G['tid']);
}
示例6: mobileoutput
public static function mobileoutput()
{
global $_G;
if (!defined('TPL_DEFAULT')) {
$content = ob_get_contents();
ob_end_clean();
$content = preg_replace("/href=\"(\\w+\\.php)(.*?)\"/e", "mobilereplace('\\1', '\\2')", $content);
ob_start();
$content = '<?xml version="1.0" encoding="utf-8"?>' . $content;
if ('utf-8' != CHARSET) {
@header('Content-Type: text/html; charset=utf-8');
$content = diconv($content, CHARSET, 'utf-8');
}
echo $content;
exit;
} elseif (defined('TPL_DEFAULT') && !$_G['cookie']['dismobilemessage'] && $_G['mobile']) {
ob_end_clean();
ob_start();
$_G['forcemobilemessage'] = true;
$query_sting_tmp = str_replace(array('&mobile=yes', 'mobile=yes'), array(''), $_SERVER['QUERY_STRING']);
$_G['setting']['mobile']['pageurl'] = $_G['siteurl'] . substr($_G['PHP_SELF'], 1) . ($query_sting_tmp ? '?' . $query_sting_tmp . '&mobile=no' : '?mobile=no');
unset($query_sting_tmp);
dsetcookie('dismobilemessage', '1', 3600);
showmessage('not_in_mobile');
exit;
}
}
示例7: cleartaskstatus
function cleartaskstatus()
{
global $_G;
if (!DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_mytask') . " WHERE uid='{$_G['uid']}' AND status='0'")) {
dsetcookie('taskdoing_' . $_G['uid']);
}
}
示例8: plugin_myrepeats
function plugin_myrepeats()
{
global $_G;
if (!$_G['uid']) {
return;
}
/* 读取可以使用马甲的用户组 usergroups 变量值。需要注意参数的读取方式,详情见插件手册-参数读取 。 */
$myrepeatsusergroups = (array) dunserialize($_G['cache']['plugin']['myrepeats']['use rgroups']);
if (in_array('', $myrepeatsusergroups)) {
$myrepeatsusergroups = array();
}
$userlist = array();
/* 对当前登录用户进行马甲验证, 即当前用户组不再权限许可范围内, 但其他帐号所在用户组有权限, 则当 前用户也有使用权限。*/
if (!in_array($_G['groupid'], $myrepeatsusergroups)) {
if (!isset($_G['cookie']['myrepeat_rr'])) {
/* 这里需要注意一下你所建的数据表对象的构建, 即 source/plugin/myrepeats/t able/下的 table_新建表名.php */
$users = count(C::t('#myrepeats#myrepeats')->fetch_all_by_username($_G['username']));
dsetcookie('myrepeat_rr', 'R' . $users, 86400);
} else {
$users = substr($_G['cookie']['myrepeat_rr'], 1);
}
if (!$users) {
return '';
}
}
/* 前台显示代码 */
$this->value['global_usernav_extra1'] = '<script>' . 'function showmyrepeats() {if(!$(\'myrepeats_menu\')) {' . 'menu=document.createElement(\'div\');menu.id=\'myrepeats_menu\';menu.style .display=\'none\';menu.className=\'p_pop\';' . '$(\'append_parent\').appendChild(menu);' . 'ajaxget(\'plugin.php?id=myrepeats:switch&list=yes\',\'myrepeats_menu\',\'a jaxwaitid\');}' . 'showMenu({\'ctrlid\':\'myrepeats\',\'duration\':2});}' . '</script>' . '<span class="pipe">|</span><a id="myrepeats" href="home.php?mod=spacecp&ac=plugin& id=myrepeats:memcp" class="showmenu cur1" onmouseover="delayShow(this, showmyrepeat s)">' . lang('plugin/myrepeats', 'switch') . '</a>' . "\n";
}
示例9: global_footer
function global_footer()
{
global $_G;
$qqmedal = unserialize($_G['setting']['qqmedal']);
if (!$_G['setting']['connect']['allow'] || $_G['cookie']['has_qqmedal'] == 1 || !$_G['cookie']['client_created'] || time() - $_G['cookie']['client_created'] > 60 && $_G['cookie']['client_created'] || !empty($_G['inajax']) || !empty($_G['inshowmessage']) || !$_G['uid'] || !$_G['member']['conisbind'] || !$qqmedal['allowed']) {
return;
}
$mid = $_G['setting']['qqmedalid'];
if (!$mid) {
return;
}
// 判断勋章是否可用
$medal = C::t('forum_medal')->fetch_all_by_id($mid);
$available = $medal[0]['available'];
if (!$available) {
return;
}
if (C::t('common_member_medal')->count_by_uid_medalid($_G['uid'], $mid)) {
$cookie_expires = 2592000;
dsetcookie('has_qqmedal', 1, $cookie_expires);
} elseif ($_G['cookie']['has_qqmedal'] == 2) {
// 待发状态奖励勋章
$result = C::t('common_member_field_forum')->fetch($_G['uid']);
$medals = $result['medals'];
$medalsnew = $medals ? $mid . "\t" . $medals : $mid;
C::t('common_member_field_forum')->update($_G['uid'], array('medals' => $medalsnew));
C::t('common_member_medal')->insert(array('uid' => $_G['uid'], 'medalid' => $mid), 0, 1);
C::t('forum_medallog')->insert(array('uid' => $_G['uid'], 'medalid' => $mid, 'type' => 0, 'dateline' => TIMESTAMP, 'expiration' => '', 'status' => 0));
$cookie_expires = 2592000;
dsetcookie('has_qqmedal', 1, $cookie_expires);
} else {
return '<link rel="stylesheet" type="text/css" href="source/plugin/qqmedal/template/qqmedal.css" /><script>showWindow(\'open_medal\', \'plugin.php?id=qqmedal:medal\');</script>';
}
}
示例10: check_update
function check_update()
{
if (defined('UPDATE_CHECKED')) {
return;
}
$ver = $_COOKIE['ver'];
if ($ver == VERSION) {
return;
}
$query = DB::query("SELECT v FROM setting WHERE k='version'", 'SILENT');
$res = DB::fetch($query);
$current_version = $res['v'];
dsetcookie('ver', $current_version);
if ($current_version != VERSION) {
// load update script
while ($current_version) {
$filepath = SYSTEM_ROOT . "./function/updater/{$current_version}.php";
if (file_exists($filepath)) {
include $filepath;
exit;
} else {
$current_version = substr($current_version, 0, strrpos($current_version, '.'));
}
}
include SYSTEM_ROOT . './function/updater/fallback.php';
exit;
} else {
define('UPDATE_CHECKED', true);
return;
}
}
示例11: make_secqaa
function make_secqaa($idhash)
{
global $_G;
loadcache('secqaa');
$secqaakey = max(1, random(1, 1));
if ($_G['cache']['secqaa'][$secqaakey]['type']) {
$etype = explode(':', $_G['cache']['secqaa'][$secqaakey]['question']);
if (count($etype) > 1 && preg_match('/^[\\w\\_]+$/', $etype[0]) && preg_match('/^[\\w\\_]+$/', $etype[1])) {
$qaafile = DISCUZ_ROOT . './source/plugin/' . $etype[0] . '/secqaa/secqaa_' . $etype[1] . '.php';
$class = $etype[1];
} else {
$qaafile = libfile('secqaa/' . $_G['cache']['secqaa'][$secqaakey]['question'], 'class');
$class = $_G['cache']['secqaa'][$secqaakey]['question'];
}
if (file_exists($qaafile)) {
@(include_once $qaafile);
$class = 'secqaa_' . $class;
if (class_exists($class)) {
$qaa = new $class();
if (method_exists($qaa, 'make')) {
$_G['cache']['secqaa'][$secqaakey]['answer'] = md5($qaa->make($_G['cache']['secqaa'][$secqaakey]['question']));
}
}
}
}
dsetcookie('secqaa' . $idhash, authcode($_G['cache']['secqaa'][$secqaakey]['answer'] . "\t" . (TIMESTAMP - 180) . "\t" . $idhash . "\t" . FORMHASH, 'ENCODE', $_G['config']['security']['authkey']), 0, 1, true);
return $_G['cache']['secqaa'][$secqaakey]['question'];
}
示例12: getinvite
function getinvite()
{
global $_G;
$result = array();
$cookies = empty($_G['cookie']['invite_auth']) ? array() : explode(',', $_G['cookie']['invite_auth']);
$cookiecount = count($cookies);
if ($cookiecount == 2) {
$id = intval($cookies[0]);
$code = $cookies[1];
$query = DB::query("SELECT * FROM " . DB::table('common_invite') . " WHERE id='{$id}'");
if ($invite = DB::fetch($query)) {
if ($invite['code'] == $code && empty($invite['fuid']) && (empty($invite['endtime']) || $_G['timestamp'] < $invite['endtime'])) {
$result['uid'] = $invite['uid'];
$result['id'] = $invite['id'];
$result['appid'] = $invite['appid'];
}
}
} elseif ($cookiecount == 3) {
$uid = intval($cookies[0]);
$code = $cookies[1];
$appid = intval($cookies[2]);
$invite_code = space_key($uid, $appid);
if ($code == $invite_code) {
$result['uid'] = $uid;
$result['appid'] = $appid;
}
}
if ($result['uid']) {
$member = getuserbyuid($result['uid']);
$result['username'] = $member['username'];
} else {
dsetcookie('invite_auth', '', -86400 * 365);
}
return $result;
}
示例13: updatemembercount
function updatemembercount($creditarr, $uids = 0, $checkgroup = true, $ruletxt = '')
{
global $_G;
if (!$uids) {
$uids = intval($_G['uid']);
}
$uids = is_array($uids) ? $uids : array($uids);
if ($uids && ($creditarr || $this->extrasql)) {
if ($this->extrasql) {
$creditarr = array_merge($creditarr, $this->extrasql);
}
$sql = array();
$allowkey = array('extcredits1', 'extcredits2', 'extcredits3', 'extcredits4', 'extcredits5', 'extcredits6', 'extcredits7', 'extcredits8', 'friends', 'posts', 'threads', 'oltime', 'digestposts', 'doings', 'blogs', 'albums', 'sharings', 'attachsize', 'views', 'todayattachs', 'todayattachsize');
$creditnotice = $_G['setting']['creditnotice'] && $_G['uid'] && $uids == array($_G['uid']);
if ($creditnotice) {
if (!isset($_G['cookiecredits'])) {
$_G['cookiecredits'] = !empty($_COOKIE['creditnotice']) ? explode('D', $_COOKIE['creditnotice']) : array_fill(0, 9, 0);
for ($i = 1; $i <= 8; $i++) {
$_G['cookiecreditsbase'][$i] = getuserprofile('extcredits' . $i);
}
}
if ($ruletxt) {
$_G['cookiecreditsrule'][$ruletxt] = $ruletxt;
}
}
//$critarr 各项积分参数extcredit设置的值
$settingValue = WebUtils::getDzPluginAppbymeAppConfig('dzsyscache_forum_extcredit_base');
foreach ($creditarr as $key => $value) {
$mutilute = 1;
foreach ($settingValue as $k => $v) {
if ($key == 'extcredits' . $k) {
$mutilute = $v * 0.01;
}
}
if (!empty($key) && $value && in_array($key, $allowkey)) {
$sql[$key] = $value * $mutilute;
if ($creditnotice && substr($key, 0, 10) == 'extcredits') {
$i = substr($key, 10);
$_G['cookiecredits'][$i] += $value * $mutilute;
}
}
}
if ($creditnotice) {
dsetcookie('creditnotice', implode('D', $_G['cookiecredits']) . 'D' . $_G['uid']);
dsetcookie('creditbase', '0D' . implode('D', $_G['cookiecreditsbase']));
if (!empty($_G['cookiecreditsrule'])) {
dsetcookie('creditrule', strip_tags(implode("\t", $_G['cookiecreditsrule'])));
}
}
//var_dump($sql);die;
if ($sql) {
C::t('common_member_count')->increase($uids, $sql);
}
if ($checkgroup && count($uids) == 1) {
$this->checkusergroup($uids[0]);
}
$this->extrasql = array();
}
}
示例14: do_login
function do_login($uid)
{
global $cookiever;
$user = DB::fetch_first("SELECT * FROM member WHERE uid='{$uid}'");
$password_hash = substr(md5($user['password']), 8, 8);
$login_exp = TIMESTAMP + 900;
dsetcookie('token', authcode("{$cookiever}\t{$uid}\t{$user[username]}\t{$login_exp}\t{$password_hash}", 'ENCODE'));
}
示例15: clearcookies
function clearcookies()
{
global $discuz_uid, $discuz_user, $discuz_pw, $discuz_secques, $adminid, $credits;
foreach (array('sid', 'auth', 'visitedfid', 'onlinedetail', 'loginuser', 'activationauth', 'indextype') as $k) {
dsetcookie($k);
}
$discuz_uid = $adminid = $credits = 0;
$discuz_user = $discuz_pw = $discuz_secques = '';
}