当前位置: 首页>>代码示例>>PHP>>正文


PHP forum_setcookie函数代码示例

本文整理汇总了PHP中forum_setcookie函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_setcookie函数的具体用法?PHP forum_setcookie怎么用?PHP forum_setcookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了forum_setcookie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set_funnycookie

 private function set_funnycookie()
 {
     global $funnyquestion_hash, $funnyquestion_remember;
     $time = time();
     forum_setcookie('funnyquestion_hash', sha1($time . get_remote_address() . $funnyquestion_hash), $time + $funnyquestion_remember);
     forum_setcookie('funnyquestion_time', $time, $time + $funnyquestion_remember);
 }
开发者ID:archlinuxpl,项目名称:forum.archlinux.org.pl,代码行数:7,代码来源:funnyquestion.php

示例2: setRead_items_cookie

    function setRead_items_cookie($status, $items)
    {
	    $cookie_name = "LF";
		$items = array();
		if(!empty($status)):
		$item_handler =& xoops_getmodulehandler('forum', 'xforum');
		$items_id = $item_handler->getIds();
		foreach($items_id as $key){
			$items[$key] = time();
		}
		endif;
		forum_setcookie($cookie_name, $items);
		return true;
    }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:14,代码来源:readforum.php

示例3: hook_register_before_header

 function hook_register_before_header()
 {
     global $required_fields, $errors, $cookie_name, $cookie_seed;
     $this->load_lang();
     $required_fields['req_word'] = $this->lang['Captcha'];
     $time = time();
     $word = random_pass(mt_rand(4, 6));
     $hash = sha1(strtolower($word) . $cookie_seed . 'secret' . $time);
     forum_setcookie($cookie_name . '_captcha', $hash . '-' . $time, $time + 120);
     $array = str_split($word);
     $mixin = random_pass(mt_rand(1, 3));
     $i = -1;
     $this->styles = '';
     foreach (str_split($mixin) as $ch) {
         $i = mt_rand($i + 1, count($array));
         array_splice($array, $i, 0, $ch);
         $this->styles .= '.masq i:nth-child(' . ($i + 1) . '){display:none;} ';
     }
     $this->spans = '<i>' . implode('</i><i>', $array) . '</i>';
 }
开发者ID:fluxbb-ru,项目名称:copyable-captcha,代码行数:20,代码来源:copyable_captcha.php

示例4: xoops_getmodulehandler

$perm =& xoops_getmodulehandler('permission', 'xforum');
$permission_set = $perm->getPermissions('forum', $forum_id);

if (!$topic_handler->getPermission($viewtopic_forum, $xforumtopic->getVar('topic_status'), "view")){
    redirect_header("viewforum.php?forum=".$forum_id, 2, _MD_NORIGHTTOVIEW);
    exit();
}

$karma_handler =& xoops_getmodulehandler('karma', 'xforum');
$user_karma = $karma_handler->getUserKarma();

$valid_modes = array("flat", "thread", "compact");
$viewmode_cookie = forum_getcookie("V");
if(isset($_GET['viewmode']) && in_array($_GET['viewmode'], $valid_modes)) {
	forum_setcookie("V", $_GET['viewmode'], $forumCookie['expire']);
}
$viewmode = isset($_GET['viewmode'])? $_GET['viewmode'] : 
			(
				!empty($viewmode_cookie)?
				$viewmode_cookie:
				(
			/*
					is_object($xoopsUser)?
					$xoopsUser->getVar('umode'):
			*/
					@$valid_modes[$xoopsModuleConfig['view_mode']-1]
				)
			);
$viewmode = in_array($viewmode, $valid_modes)?$viewmode:"flat";
$order = (isset($_GET['order']) && in_array(strtoupper($_GET['order']),array("DESC","ASC")))?$_GET['order']:"ASC";
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:30,代码来源:viewtopic.php

示例5: set_tracked_topics

function set_tracked_topics($tracked_topics)
{
    global $cookie_name, $cookie_path, $cookie_domain, $cookie_secure, $forum_config;
    $return = ($hook = get_hook('fn_set_tracked_topics_start')) ? eval($hook) : null;
    if ($return != null) {
        return;
    }
    $cookie_data = '';
    if (!empty($tracked_topics)) {
        // Sort the arrays (latest read first)
        arsort($tracked_topics['topics'], SORT_NUMERIC);
        arsort($tracked_topics['forums'], SORT_NUMERIC);
        // Homebrew serialization (to avoid having to run unserialize() on cookie data)
        foreach ($tracked_topics['topics'] as $id => $timestamp) {
            $cookie_data .= 't' . $id . '=' . $timestamp . ';';
        }
        foreach ($tracked_topics['forums'] as $id => $timestamp) {
            $cookie_data .= 'f' . $id . '=' . $timestamp . ';';
        }
        // Enforce a 4048 byte size limit (4096 minus some space for the cookie name)
        if (strlen($cookie_data) > 4048) {
            $cookie_data = substr($cookie_data, 0, 4048);
            $cookie_data = substr($cookie_data, 0, strrpos($cookie_data, ';')) . ';';
        }
    }
    forum_setcookie($cookie_name . '_track', $cookie_data, time() + $forum_config['o_timeout_visit']);
    $_COOKIE[$cookie_name . '_track'] = $cookie_data;
    // Set it directly in $_COOKIE as well
}
开发者ID:torepublicStartpageCode,项目名称:torepublic2,代码行数:29,代码来源:functions.php

示例6: error_reporting

//  Project: X-Forum 4                                                       //
//  ------------------------------------------------------------------------ //


include_once '../../mainfile.php';
error_reporting(E_ALL);
include_once XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/include/vars.php";
include_once XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/include/functions.php";
include_once XOOPS_ROOT_PATH."/Frameworks/art/functions.php";

$myts =& MyTextSanitizer::getInstance();

// menumode cookie
if(isset($_REQUEST['menumode'])){
	$menumode = intval($_REQUEST['menumode']);
	forum_setcookie("M", $menumode, $forumCookie['expire']);
}else{
	$cookie_M = intval(forum_getcookie("M"));
	$menumode = ($cookie_M === null || !isset($valid_menumodes[$cookie_M]))?$xoopsModuleConfig['menu_mode']:$cookie_M;
}

$menumode_other = array();
$menu_url = htmlSpecialChars(preg_replace("/&menumode=[^&]/", "", $_SERVER[ 'REQUEST_URI' ]));
$menu_url .= (false === strpos($menu_url, "?"))?"?menumode=":"&amp;menumode=";
foreach($valid_menumodes as $key=>$val){
	if($key != $menumode) $menumode_other[]=array("title"=>$val, "link"=>$menu_url.$key);
}

$forum_module_header = '';
$forum_module_header .= '<link rel="alternate" type="application/rss+xml" title="'.$xoopsModule->getVar('name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/rss.php" />';
if(!empty($xoopsModuleConfig['pngforie_enabled'])){
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:31,代码来源:header.php

示例7: set_tracked_topics

function set_tracked_topics($tracked_topics)
{
    global $cookie_name, $cookie_path, $cookie_domain, $cookie_secure, $pun_config;
    $cookie_data = '';
    if (!empty($tracked_topics)) {
        // Sort the arrays (latest read first)
        arsort($tracked_topics['topics'], SORT_NUMERIC);
        arsort($tracked_topics['forums'], SORT_NUMERIC);
        // Homebrew serialization (to avoid having to run unserialize() on cookie data)
        foreach ($tracked_topics['topics'] as $id => $timestamp) {
            $cookie_data .= 't' . $id . '=' . $timestamp . ';';
        }
        foreach ($tracked_topics['forums'] as $id => $timestamp) {
            $cookie_data .= 'f' . $id . '=' . $timestamp . ';';
        }
        // Enforce a byte size limit (4096 minus some space for the cookie name - defaults to 4048)
        if (strlen($cookie_data) > FORUM_MAX_COOKIE_SIZE) {
            $cookie_data = substr($cookie_data, 0, FORUM_MAX_COOKIE_SIZE);
            $cookie_data = substr($cookie_data, 0, strrpos($cookie_data, ';')) . ';';
        }
    }
    forum_setcookie($cookie_name . '_track', $cookie_data, time() + $pun_config['o_timeout_visit']);
    $_COOKIE[$cookie_name . '_track'] = $cookie_data;
    // Set it directly in $_COOKIE as well
}
开发者ID:HawesDomingue,项目名称:mechanic-watson,代码行数:25,代码来源:functions.php

示例8: Criteria

        */
		break;
	default:
		$criteria_type_count = new Criteria("approved", 1);
		$criteria_type_post = new Criteria("p.approved", 1);
		break;
}
$criteria_count->add($criteria_type_count);
$criteria_post->add($criteria_type_post);

$karma_handler =& xoops_getmodulehandler('karma', 'xforum');
$user_karma = $karma_handler->getUserKarma();

$valid_modes = array("flat", "compact");
$viewmode_cookie = forum_getcookie("V");
if(isset($_GET['viewmode'])&&$_GET['viewmode']=="compact") forum_setcookie("V", "compact", $forumCookie['expire']);
$viewmode = isset($_GET['viewmode'])?
			$_GET['viewmode']:
			(
				!empty($viewmode_cookie)?
				$viewmode_cookie:
				(
				/*
					is_object($xoopsUser)?
					$xoopsUser->getVar('umode'):
				*/
					@$valid_modes[$xoopsModuleConfig['view_mode']-1]
				)
			);
$viewmode = in_array($viewmode, $valid_modes)?$viewmode:"flat";
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:30,代码来源:viewpost.php

示例9: user_login

 private function user_login($user_id, $prev_url = '')
 {
     global $forum_config, $lang_fancy_login_loginza, $forum_user, $forum_db, $cookie_name, $forum_url;
     // Load the login language file
     if (!isset($lang_login)) {
         require FORUM_ROOT . 'lang/' . $forum_user['language'] . '/login.php';
     }
     // Get user info matching login attempt
     $query = array('SELECT' => 'u.id, u.group_id, u.password, u.salt, u.activate_key', 'FROM' => 'users AS u', 'WHERE' => 'u.id=\'' . $forum_db->escape($user_id) . '\'');
     $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
     list($user_id, $group_id, $db_password_hash, $salt, $activate_key) = $forum_db->fetch_row($result);
     //
     if ($group_id == FORUM_UNVERIFIED && !empty($activate_key)) {
         message($lang_fancy_login_loginza['Activate first']);
     }
     // Remove this user's guest entry from the online list
     $query = array('DELETE' => 'online', 'WHERE' => 'ident=\'' . $forum_db->escape(get_remote_address()) . '\'');
     ($hook = get_hook('li_login_qr_delete_online_user')) ? eval($hook) : null;
     $forum_db->query_build($query) or error(__FILE__, __LINE__);
     $expire = time() + 1209600;
     forum_setcookie($cookie_name, base64_encode($user_id . '|' . $db_password_hash . '|' . $expire . '|' . sha1($salt . $db_password_hash . forum_hash($expire, $salt))), $expire);
     ($hook = get_hook('li_login_pre_redirect')) ? eval($hook) : null;
     //if (empty($prev_url)) {
     $prev_url = forum_link($forum_url['index']);
     //}
     redirect(forum_htmlencode($prev_url) . (substr_count($prev_url, '?') == 1 ? '&amp;' : '?') . 'login=1', $lang_login['Login redirect']);
 }
开发者ID:mdb-webdev,项目名称:Fancy-Extensions,代码行数:27,代码来源:fancy_loginza_loginza.inc.php

示例10: setRead_cookie

    function setRead_cookie($read_item, $post_id)
    {
	    $cookie_name = ($this->type == "forum") ? "LF" : "LT";
		$lastview = forum_getcookie($cookie_name, true);
		$lastview[$read_item] = time();
		forum_setcookie($cookie_name, $lastview);
    }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:7,代码来源:read.php

示例11: pun_stop_bots_set_cookie

function pun_stop_bots_set_cookie($question_id)
{
    global $forum_user, $cookie_name, $cookie_path, $cookie_domain, $cookie_secure;
    $now = time();
    $expire_time = $now + 1209600;
    $expire_hash = sha1($forum_user['salt'] . forum_hash($expire_time, $forum_user['salt']));
    $question_hash = forum_hash($question_id, $forum_user['salt']);
    forum_setcookie(PUN_STOP_BOTS_COOKIE_NAME, base64_encode($forum_user['id'] . '|' . $question_hash . '|' . $expire_time . '|' . $expire_hash), $expire_time);
}
开发者ID:mdb-webdev,项目名称:extensions,代码行数:9,代码来源:functions.php

示例12: setRead_items_cookie

    function setRead_items_cookie($status, $forum_id)
    {
	    $cookie_name = "LT";
	    $cookie_vars = forum_getcookie($cookie_name, true);
	    
		$item_handler =& xoops_getmodulehandler('topic', 'xforum');
		$criteria =& new CriteriaCompo(new Criteria("forum_id", $forum_id));
		$criteria->setSort("topic_last_post_id");
		$criteria->setOrder("DESC");
		$criteria->setLimit($this->items_per_forum);
		$items = $item_handler->getIds($criteria);
	    
	    foreach($items as $var){
		    if(empty($status)){
			    if(isset($cookie_vars[$var])) unset($cookie_vars[$var]);
		    }else{
			    $cookie_vars[$var] = time() /*$items[$var]*/;
		    }
	    }
		forum_setcookie($cookie_name, $cookie_vars);
		return true;
    }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:22,代码来源:readtopic.php

示例13: preg_replace

if(empty($forumCookie['prefix'])){
	$cookie_prefix = preg_replace("/[^a-z_0-9]+/i", "_", preg_replace("/(http(s)?:\/\/)?(www.)?/i","",XOOPS_URL));
	$cookie_userid = (is_object($xoopsUser))?$xoopsUser->getVar('uid'):0;
	$forumCookie['prefix'] = $cookie_prefix."_".$xoopsModule->dirname().'_'.$cookie_userid."_";
}

// set LastVisitTemp cookie, which only gets the time from the LastVisit cookie if it does not exist yet
// otherwise, it gets the time from the LastVisitTemp cookie
//$last_visit = forum_getcookie("LVT");
$last_visit = forum_getsession("LV");
$last_visit = ($last_visit)?$last_visit:forum_getcookie("LV");
$last_visit = ($last_visit)?$last_visit:time();


// update LastVisit cookie.
forum_setcookie("LV", time(), $forumCookie['expire']); // set cookie life time to one month
//forum_setcookie("LVT", $last_visit);
forum_setsession("LV", $last_visit);

/* xforum cookie storage
	Long term cookie: (configurable, generally one month)
		LV - Last Visit
		M - Menu mode
		V - View mode
		G - Toggle
	Short term cookie: (same as session life time)
		ST - Stored Topic IDs for mark
		LP - Last Post
		LF - Forum Last view
		LT - Topic Last read
		LVT - Last Visit Temp
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:31,代码来源:vars.php

示例14: set_forum_login_cookie

function set_forum_login_cookie($id, $forum_password)
{
    global $panther_config;
    $cookie_data = isset($_COOKIE[$panther_config['o_cookie_name'] . '_forums']) ? $_COOKIE[$panther_config['o_cookie_name'] . '_forums'] : '';
    if (!$cookie_data || strlen($cookie_data) > FORUM_MAX_COOKIE_SIZE) {
        $cookie_data = '';
    }
    $cookie_data = unserialize($cookie_data);
    $salt = random_key(64, true);
    $cookie_hash = panther_hash($forum_password . panther_hash($salt));
    $cookie_data[$id] = array('hash' => $cookie_hash, 'salt' => $salt);
    forum_setcookie($panther_config['o_cookie_name'] . '_forums', serialize($cookie_data), time() + $panther_config['o_timeout_visit']);
    $_COOKIE[$panther_config['o_cookie_name'] . '_forums'] = serialize($cookie_data);
}
开发者ID:mtechnik,项目名称:pantherforum,代码行数:14,代码来源:functions.php

示例15: get_hook

                     ($hook = get_hook('rg_register_dupe_email')) ? eval($hook) : null;
                     forum_mail($forum_config['o_mailing_list'], $mail_subject, $mail_message);
                 }
                 ($hook = get_hook('rg_register_pre_login_redirect')) ? eval($hook) : null;
                 // Must the user verify the registration or do we log him/her in right now?
                 if ($forum_config['o_regs_verify'] == '1') {
                     message(sprintf($lang_profile['Reg e-mail'], '<a href="mailto:' . forum_htmlencode($forum_config['o_admin_email']) . '">' . forum_htmlencode($forum_config['o_admin_email']) . '</a>'));
                 } else {
                     // Remove cache file with forum stats
                     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
                         require FORUM_ROOT . 'include/cache.php';
                     }
                     clean_stats_cache();
                 }
                 $expire = time() + $forum_config['o_timeout_visit'];
                 forum_setcookie($cookie_name, base64_encode($new_uid . '|' . $password_hash . '|' . $expire . '|' . sha1($salt . $password_hash . forum_hash($expire, $salt))), $expire);
                 if (!isset($_SESSION['req_buyer_account'])) {
                     //INCREASE THE INVITED COUNTER
                     $query = array('SELECT' => 'u.invited', 'FROM' => 'users AS u', 'WHERE' => 'u.username=\'' . $forum_db->escape($username2) . '\'');
                     $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                     $array2 = $forum_db->fetch_assoc($result);
                     $invited = $array2['invited'];
                     $invited2 = $invited + 1;
                     $query = array('UPDATE' => 'users', 'SET' => "invited='{$invited2}'", 'WHERE' => 'username=\'' . $forum_db->escape($username2) . '\'');
                     $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                 }
                 redirect(forum_link($forum_url['index']), $lang_profile['Reg complete']);
             }
         }
     }
 }
开发者ID:torepublicStartpageCode,项目名称:torepublic2,代码行数:31,代码来源:register.php


注:本文中的forum_setcookie函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。