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


PHP cookie::get方法代码示例

本文整理汇总了PHP中cookie::get方法的典型用法代码示例。如果您正苦于以下问题:PHP cookie::get方法的具体用法?PHP cookie::get怎么用?PHP cookie::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cookie的用法示例。


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

示例1: init

 function init() {
     if(!union::getconfig('enabled')) {
         echo '<script type="text/javascript">alert("'.lang('推广联盟未开启,转让会员中心!').'")</script>';
         front::refresh(url::create('user/index'));
     }
     $user='';
     if(cookie::get('login_username') &&cookie::get('login_password')) {
         $user=new user();
         $user=$user->getrow(array('username'=>cookie::get('login_username')));
     }
     if(!is_array($user) &&front::$act != 'into'&&front::$act != 'login'&&front::$act != 'register'&&front::$act != 'login_js'&&front::$act != 'login_success'&&front::$act != 'getpass'&&front::$act != 'edit'){
     	front::redirect(url::create('user/login'));
     }else{
     	if (is_array($user) && cookie::get('login_password') == front::cookie_encode($user['password'])) {
     		$this->view->user = $user;
     		$this->view->usergroupid = $user['groupid'];
     		$obj = new usergroup();
     		$this->roles = $obj->getrow(array('groupid'=>$this->view->usergroupid));
     	}
     }
     $this->_user=new user;
     $this->view->form = $this->_user->get_form();
     $this->view->field = $this->_user->getFields();
     $this->view->primary_key=$this->_user->primary_key;
     $this->view->data = $this->view->user;
     $this->_union = new union();
     $this->view->uniondata = $this->_union->getrow(array('userid'=>$this->view->data['userid']));
     if(!$this->view->uniondata &&front::$act != 'register'&&front::$act != 'into') {
         echo '<script type="text/javascript">alert("'.lang('未申请账号,转入联盟申请页面!').'");window.location.href="'.url::create('union/register').'";</script>';
         //front::refresh(url::create('union/register'));
     }
     $this->_pagesize=config::get('manage_pagesize');
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:33,代码来源:union_act.php

示例2: show

 /**
  * Methode : page de détail d'une user
  */
 public function show($idQuete = false)
 {
     if (!$idQuete || !is_numeric($idQuete)) {
         return parent::redirect_erreur('quetes');
     }
     cookie::set('UserFilesPath', url::base() . '../images/quetes/' . $idQuete);
     cookie::set('UserFilesAbsolutePath', DOCROOT . '../images/quetes/' . $idQuete);
     if (!cookie::get('UserFilesPath')) {
         return url::redirect('quetes/show/' . $idQuete);
     }
     if (!($quete = $this->quete->select(array('id_quete' => $idQuete), 1))) {
         return parent::redirect_erreur('quetes');
     }
     if (!($module = Map_Model::instance()->select(array('module_map' => 'quete'), false))) {
         return url::redirect('regions?msg=' . urlencode(Kohana::lang('quete.no_module')));
     }
     $this->script = array('js/lib/jquery.validate', 'js/lib/jquery.facebox', 'js/quetes');
     $this->css = array('form', 'quete', 'facebox');
     $this->template->titre = array(Kohana::lang('quete.all_quetes') => 'quetes', Kohana::lang('quete.show_title', ucfirst(mb_strtolower($quete->title))) => NULL);
     $this->template->button = TRUE;
     $this->template->navigation = parent::navigation($idQuete, 'id_quete', 'quetes');
     $this->template->contenu = new View('formulaire/form');
     $this->template->contenu->action = 'quetes/save';
     $this->template->contenu->id = $idQuete;
     $this->template->contenu->formulaire = new View('quetes/show');
     $this->template->contenu->formulaire->row = $quete;
     $this->template->contenu->formulaire->module = $module;
     $this->template->contenu->formulaire->bots = Map_Model::instance()->select(array('module_map' => 'fight'), false);
     $this->template->contenu->formulaire->quete = $this->quete->select(array('id_quete !=' => $idQuete));
 }
开发者ID:ezioms,项目名称:RpgEditor,代码行数:33,代码来源:quetes.php

示例3: show

 /**
  * Methode : page de détail d'un article
  */
 public function show($idActualite = FALSE)
 {
     if (!$idActualite || !is_numeric($idActualite)) {
         return parent::redirect_erreur('articles');
     }
     cookie::set('UserFilesPath', url::base() . '../images/articles/' . $idActualite);
     cookie::set('UserFilesAbsolutePath', DOCROOT . '../images/articles/' . $idActualite);
     if (!cookie::get('UserFilesPath')) {
         return url::redirect('articles/show/' . $idActualite);
     }
     if (!($actualite = $this->acticles->select(array('id_article' => $idActualite), TRUE))) {
         return parent::redirect_erreur('articles');
     }
     $actualiteCategories = $this->acticles->selectListeCategories();
     $this->script = array('js/lib/jquery.validate', 'js/articles');
     $this->css = array('form', 'article');
     $this->template->titre = array(Kohana::lang('article.all_article') => 'articles', $actualite->title => NULL);
     $this->template->button = TRUE;
     $this->template->navigation = $this->acticles->navigation($idActualite, 'id_article', 'articles');
     $this->template->navigationURL = 'articles/show';
     $this->template->contenu = new View('formulaire/form');
     $this->template->contenu->action = 'articles/save';
     $this->template->contenu->id = $idActualite;
     $this->template->contenu->formulaire = new View('articles/show');
     $this->template->contenu->formulaire->row = $actualite;
     $this->template->contenu->formulaire->actualiteCategories = $actualiteCategories;
     $this->template->contenu->formulaire->regions = Region_Model::instance()->listing_parent();
 }
开发者ID:ezioms,项目名称:RpgEditor,代码行数:31,代码来源:articles.php

示例4: init

 function init() {
     $user='';
     $guest = front::get('guest');
     if($guest=='1'&&config::get('opguestadd')) {
         $user = 'Guest';
     }else {
         if(cookie::get('login_username') &&cookie::get('login_password')) {
             $user=new user();
             $user=$user->getrow(array('username'=>cookie::get('login_username')));
         }
     }
     if(cookie::get('login_username') &&cookie::get('login_password')) {
         $guestuser=new user();
         $guestuser=$guestuser->getrow(array('username'=>cookie::get('login_username')));
     }
     $this->view->guestuser = $guestuser;
     if(!$user &&front::$act != 'login'&&front::$act != 'register')  front::redirect(url::create('user/login'));
     $this->view->user=$user;
     $this->_user=new user;
     $this->table=front::get('manage');
     if($this->table <>'archive'&&$this->table <>'orders') exit('PAGE NOT FOUND!');
     $this->_table=new $this->table;
     $this->_table->getFields();
     $this->view->form=$this->_table->get_form();
     $this->_pagesize=config::get('manage_pagesize');
     $this->view->manage=$this->table;
     $this->view->primary_key=$this->_table->primary_key;
     if(!front::get('page')) front::$get['page']=1;
     $manage='table_'.$this->table;
     $this->manage=new $manage;
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:31,代码来源:manage_act.php

示例5: required

 static function required($perm_name, $item)
 {
     // Original code from the required function in modules/gallery/helpers/access.php.
     if (!access::can($perm_name, $item)) {
         if ($perm_name == "view") {
             // Treat as if the item didn't exist, don't leak any information.
             throw new Kohana_404_Exception();
         } else {
             access::forbidden();
         }
         // Begin rWatcher modifications.
         //   Throw a 404 error when a user attempts to access a protected item,
         //   unless the password has been provided, or the user is the item's owner.
     } elseif (module::get_var("albumpassword", "hideonly") == false) {
         $item_protected = ORM::factory("albumpassword_idcache")->where("item_id", "=", $item->id)->order_by("cache_id")->find_all();
         if (count($item_protected) > 0) {
             $existing_password = ORM::factory("items_albumpassword")->where("id", "=", $item_protected[0]->password_id)->find();
             if ($existing_password->loaded()) {
                 if (cookie::get("g3_albumpassword") != $existing_password->password && identity::active_user()->id != $item->owner_id && !identity::active_user()->admin) {
                     throw new Kohana_404_Exception();
                 }
             }
         }
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:25,代码来源:MY_access.php

示例6: get

 /**
  * Fetch a cookie value, using the Input library.
  *
  * @param   string   cookie name
  * @param   mixed    default value
  * @param   boolean  use XSS cleaning on the value
  * @return  string
  */
 public static function get($name = NULL, $default = NULL, $xss_clean = FALSE)
 {
     // Return an array of all the cookies if we don't have a name
     if ($name === NULL) {
         $cookies = array();
         foreach ($_COOKIE as $key => $value) {
             $cookies[$key] = cookie::get($key, $default, $xss_clean);
         }
         return $cookies;
     }
     if (!isset($_COOKIE[$name])) {
         return $default;
     }
     // Get the cookie value
     $cookie = $_COOKIE[$name];
     // Find the position of the split between salt and contents
     $split = strlen(cookie::salt($name, NULL));
     if (isset($cookie[$split]) and $cookie[$split] === '~') {
         // Separate the salt and the value
         list($hash, $value) = explode('~', $cookie, 2);
         if (cookie::salt($name, $value) === $hash) {
             if ($xss_clean === TRUE and Kohana::config('core.global_xss_filtering') === FALSE) {
                 return Input::instance()->xss_clean($value);
             }
             // Cookie signature is valid
             return $value;
         }
         // The cookie signature is invalid, delete it
         cookie::delete($name);
     }
     return $default;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:40,代码来源:cookie.php

示例7: index_action

 function index_action() {
     if (front::post('submit')) {
         if (!front::post('ballot')) {
             front::alert(lang('Please_select_vote'));
             return false;
         }
         if (config::get('checkip')) {
             $time=cookie::get('vttime');
             if (time() -$time <config::get('timer') * 60) {
                 front::alert(lang('You_have_voted'));
                 return false;
             }
         }
         $bid=front::$post['bid'];
         if (is_array(front::$post['ballot'])) {
             $ids=implode(',',front::$post['ballot']);
         }
         else {
             $ids=front::$post['ballot'];
         }
         if(preg_match('/(select|union|and|\'|"|\))/i',$ids)){
         	exit('非法参数');
         }
         if(preg_match('/(select|union|and|\'|"|\))/i',$bid)){
         	exit('非法参数');
         }
         $where="id in($ids)";
         $data='num=num+1';
         $option=new option();
         $option->rec_update($data,$where);
         $this->_table->rec_update($data,$bid);
         cookie::set('vttime',time(),time() +3600 * 24);
         front::alert(lang('Successful_vote'));
     }
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:35,代码来源:ballot_act.php

示例8: _before_index

 public function _before_index()
 {
     $model = D("MisSystemRecursion");
     $MisSystemCompanyDao = M("mis_system_company");
     $where = array();
     $where['status'] = 1;
     $companylist = $MisSystemCompanyDao->where($where)->select();
     $this->assign("companylist", $companylist);
     //构造结构树
     $param['url'] = "__URL__/index/jump/jump/parentid/#id#/id/#id#";
     $param['rel'] = "MisSystemCompanyZtree";
     $param['open'] = "true";
     $param['isParent'] = "true";
     if ($companylist) {
         $companyztree = $this->getTree($companylist, $param);
     }
     //高亮默认选中节点
     $parentid = $_REQUEST['parentid'];
     if (empty($parentid)) {
         $parentid = cookie::get("missystemcompanyid");
         cookie::delete("missystemcompanyid");
         if (empty($parentid)) {
             $parentid = $companylist[0]['id'];
         }
     }
     $this->assign('valid', $parentid);
     //赋值用于boolbar
     $this->assign('parentid', $parentid);
     $this->assign("companyztree", $companyztree);
 }
开发者ID:tmlsoft,项目名称:main,代码行数:30,代码来源:MisSystemCompanyAction.class.php

示例9: test_get

	/**
	 * Tests cookie::set()
	 *
	 * @test
	 * @dataProvider provider_get
	 * @covers cookie::get
	 * @param mixed   $key      key to use
	 * @param mixed   $value    value to set
	 * @param boolean $expected Output for cookie::get()
	 */
	public function test_get($key, $value, $expected)
	{
		// Force $_COOKIE
		if ($key !== NULL)
			$_COOKIE[$key] = $value;

		$this->assertSame($expected, cookie::get($key));
	}
开发者ID:nevermlnd,项目名称:cv,代码行数:18,代码来源:CookieTest.php

示例10: read

 public function read($id)
 {
     $data = (string) cookie::get($this->cookie_name);
     if ($data == '') {
         return $data;
     }
     return base64_decode($data);
 }
开发者ID:atlas1308,项目名称:testtesttestfarm,代码行数:8,代码来源:cookie.php

示例11: logout

 /**
  * Log a user out and remove any auto-login cookies.
  *
  * @param   boolean  completely destroy the session
  * @return  boolean
  */
 public function logout($destroy)
 {
     if (cookie::get('authautologin')) {
         // Delete the autologin cookie to prevent re-login
         cookie::delete('authautologin');
     }
     return parent::logout($destroy);
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:14,代码来源:ORM.php

示例12: read

 public function read($id)
 {
     $data = (string) cookie::get($this->cookie_name);
     if ($data == '') {
         return $data;
     }
     return empty($this->encrypt) ? base64_decode($data) : $this->encrypt->decode($data);
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:8,代码来源:Cookie.php

示例13: __construct

 function __construct()
 {
     // Check and see if this is being run from the command line
     define('IS_CLI', 'cli' == PHP_SAPI);
     parent::__construct();
     Footsteps::step();
     $this->template->title = ucwords(router::$method);
     $this->session = Session::instance();
     $this->template->robots = '';
     if (router::$controller != 'page') {
         if (!Auth::instance()->logged_in() and !cookie::get('qaargh_visited', false, true)) {
             $this->session->set_flash('notice', 'It looks like this is your first time here. Click "home" to find out more about Q-Aargh!');
             cookie::set(array('name' => 'qaargh_visited', 'value' => true, 'expire' => 31536000));
         }
     } else {
         cookie::set(array('name' => 'qaargh_visited', 'value' => true, 'expire' => 31536000));
     }
     try {
         $this->template->view = new View(strtolower(router::$controller . '/' . router::$method));
     } catch (Exception $e) {
         $this->template->view = new View('error/missing_view');
     }
     if (Auth::instance()->logged_in()) {
         $this->template->menu = new View('menu/logged_in');
     } else {
         $this->template->menu = new View('menu/logged_out');
     }
     // Handle built-in authorization
     if (array_key_exists(router::$method, $this->auth_required)) {
         // If it's in the array, you must at least be logged in.
         if (!Auth::instance()->logged_in()) {
             $this->session->set_flash('error', Kohana::lang('general.login_required'));
             url::redirect("/user/login");
         }
         $authorized = false;
         // If it's *, then being logged in is enough
         if ('*' == $this->auth_required[router::$method]) {
             $authorized = true;
         } else {
             if (is_array($this->auth_required[router::$method])) {
                 foreach ($this->auth_required[router::$method] as $right) {
                     if (Auth::instance()->logged_in($right)) {
                         $authorized = false;
                         break;
                     }
                 }
             } else {
                 if (Auth::instance()->logged_in($this->auth_required[router::$method])) {
                     $authorized = false;
                 }
             }
         }
         if (!$authorized) {
             $this->session->set_flash('error', Kohana::lang('general.insufficient_privileges'));
             url::redirect("/user");
         }
     }
 }
开发者ID:jmhobbs,项目名称:q-aargh,代码行数:58,代码来源:application.php

示例14: readCart

 /**
  * 显示购物车内容
  *
  * @return array
  *
  * @example 返回数据类型为:array(array(商品ID, 商品名称, 商品数量, 商品单价, array(其实信息)), array(...));
  */
 public function readCart()
 {
     // 从购物车cookie中读取数据
     $data = cookie::get($this->cartName);
     if (!$data) {
         return false;
     }
     return $data;
 }
开发者ID:marslabtron,项目名称:waimai,代码行数:16,代码来源:CartCookie.class.php

示例15: __construct

 /**
  * 构造函数
  */
 public function __construct()
 {
     $cookie = cookie::get(COOKIE_KEY);
     if (!$cookie) {
         redirect('./');
         return;
     }
     view::assign('setting', madmin::get_setting());
     view::assign('now', time());
 }
开发者ID:luozhanhong,项目名称:share,代码行数:13,代码来源:admin.php


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