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


PHP get_cookie函数代码示例

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


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

示例1: editAction

 public function editAction()
 {
     $department_id = fpBase('http')->getParam('department_id');
     if (!empty($department_id)) {
         $result = M('department')->find('pid=' . intval($department_id));
         if ($result) {
             exit(json_encode(array('statusCode' => 300, 'message' => '错误选择,选择的部门还有下级,请选择所在部门')));
         }
     }
     $uid = fpBase('http')->getParam('id');
     $user = M('user')->find('id=' . intval($uid));
     if (!empty($user)) {
         $dep = M('department')->getSelect($user['department_id']);
     } else {
         exit(json_encode(array('statusCode' => 300, 'message' => '用户不存在')));
     }
     $password = fpBase('http')->getPost('password');
     if (empty($password)) {
         unset($_POST['password']);
     } else {
         $_POST['password'] = md5($_POST['password']);
     }
     if (fpBase('http')->isPost()) {
         fpBase('cache')->write('user_uid_' . get_cookie('uid'), null);
     }
     $this->assign('dep', $dep);
     parent::editAction();
 }
开发者ID:jeremywong1992,项目名称:companyBook,代码行数:28,代码来源:userController.php

示例2: __construct

 function __construct()
 {
     $this->ci =& get_instance();
     $this->ci->load->database();
     $this->ci->load->config('linkedin_oauth', TRUE);
     $this->ci->load->config('users', TRUE);
     $this->ci->load->library('ion_auth');
     $this->ci->load->library('session');
     $this->ci->load->library('form_validation');
     $this->ci->load->library('input');
     $this->ci->load->helper('image/image_resize');
     $this->ci->load->helper('logger');
     $this->ci->load->helper('linkedin/linkedin_api');
     $this->ci->load->model('linkedin/linkedin_model');
     $this->ci->load->model('invitation_model');
     $this->ci->load->model('preferences_model');
     $this->ci->load->model('user_model');
     $this->ci->load->model('user_rating_model');
     $this->ci->load->model('user_lunch_wishlist_model');
     $this->ci->load->model('user_lunch_buddy_model');
     $this->ci->load->model('user_profile_model');
     // Set Config
     $this->component_class = $this->ci->config->item('component_class', 'ls_notifications');
     //auto-login the user if they are remembered
     if (!$this->ci->ion_auth->logged_in() && get_cookie('identity') && get_cookie('remember_code')) {
         $this->ci->ion_auth = $this;
         $this->ci->ion_auth_model->login_remembered_user();
     }
     $this->ci->ion_auth_model->trigger_events('library_constructor');
 }
开发者ID:laiello,项目名称:skrapshcnul,代码行数:30,代码来源:ls_preferences.php

示例3: _init

	/**
	 * Initialise User Library
	 *
	 * Several jobs to perform
	 * > Check for autologin
	 * > Delete un activated user accounts
	 *
	 * @access private
	 */
	function _init()
	{
		// Log the user in if autologin details are correct
		if( !$this->is_user())
		{
			if (FALSE !== ($autologin = get_cookie('autologin')))
			{
				// Autologin data exists
				$autologin = unserialize($autologin);

				// Check its valid
				$result = $this->CI->user_model->validateLogin($autologin['login_field'],$autologin['password']);
				if($result['valid'])
				{
					// Log user in
					$this->set_userlogin($autologin['id']);
					log_message('debug','BackendPro->Userlib->_init : User logged in using autologin cookie');
				}
			}
		}

		// Remove any user accounts which have not been activated
		// within the specified deadline
		$query = $this->CI->user_model->delete('Users','DATE_ADD(created,INTERVAL '.$this->CI->preference->item('account_activation_time').' DAY) <= NOW() AND active=0');
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:34,代码来源:Userlib.php

示例4: enter

 public function enter()
 {
     $id = get_cookie("slave_game_user_id");
     if ($id == NULL) {
         // create new user
         $this->load->view('index', []);
         return;
     }
     $query = $this->db->get_where('user', array('id' => $id));
     $data = $query->row();
     switch ($data->state) {
         case 7:
             $this->still_cool($id);
         case 1:
         case 2:
             $this->load->view("owner/palace", ['user' => $data]);
             break;
         case 3:
         case 4:
         case 5:
             $this->load->view("slave/square", ['user' => $data, 'owner_name' => $this->get_current_owner($id)]);
             break;
         case 6:
             if ($this->still_cool($id)) {
                 $this->load->view("slave/jail", ['user' => $data]);
             } else {
                 $this->load->view("slave/square", ['user' => $data, 'owner_name' => $this->get_current_owner($id)]);
             }
             break;
         default:
             break;
     }
 }
开发者ID:speedscorpion,项目名称:slave_proj,代码行数:33,代码来源:Player.php

示例5: view

 public function view($page = 'home')
 {
     $this->load->model('api_model');
     $this->load->database();
     if (!file_exists(APPPATH . '/views/pages/' . $page . '.php')) {
         // Whoops, we don't have a page for that!
         die("<center><font face=tahoma><div dir=rtl>صفحه مورد نظر پیدا نشد.");
     }
     if ($page == "api") {
         $data['title'] = ucfirst($page);
         // Capitalize the first letter
         $this->load->view('pages/' . $page, $data);
         return;
     }
     $data['title'] = ucfirst($page);
     // Capitalize the first letter
     $this->load->view('templates/header', $data);
     if (null != get_cookie("username") && null != get_cookie("password") && null != get_cookie("name") && null != get_cookie("id")) {
         $u = get_cookie("username");
         $p = get_cookie("password");
         $query = $this->db->query("SELECT * FROM user WHERE email = '" . $u . "'  AND sha1(password)='" . $p . "'");
         if ($query->num_rows() < 1) {
             delete_cookie("username");
         }
         $this->load->view('pages/' . $page, $data);
     } else {
         $this->load->view('pages/home-nologin', $data);
     }
     $this->load->view('templates/footer', $data);
 }
开发者ID:arashrasoulzadeh,项目名称:gameID,代码行数:30,代码来源:Pages.php

示例6: L

/**
 * 语言文件处理
 *
 * @param    string $language 标示符
 * @param    array $pars      转义的数组,二维数组 ,'key1'=>'value1','key2'=>'value2',
 * @param    string $apps     多个模块之间用半角逗号隔开,如:member,guestbook
 * @return    string        语言字符
 */
function L($language = 'empty language', $pars = array(), $apps = '')
{
    static $LANG = array();
    static $LANG_APPS = array();
    static $lang = '';
    $language = str_replace(' ', '_', $language);
    $lang = get_cookie('lang') ? get_cookie('lang') : LANG;
    if (!$LANG) {
        require_once COREFRAME_ROOT . 'languages' . '/' . $lang . '/system.lang.php';
        if (file_exists(COREFRAME_ROOT . 'languages' . '/' . $lang . '/' . M . '.lang.php')) {
            require_once COREFRAME_ROOT . 'languages' . '/' . $lang . '/' . M . '.lang.php';
        }
    }
    if (!empty($apps)) {
        $apps = explode(',', $apps);
        foreach ($apps as $app) {
            if (!isset($LANG_APPS[$app])) {
                require_once COREFRAME_ROOT . 'languages' . '/' . $lang . '/' . $app . '.lang.php';
            }
        }
    }
    if (!array_key_exists($language, $LANG)) {
        return $language;
    } else {
        $language = $LANG[$language];
        if ($pars) {
            foreach ($pars as $_k => $_v) {
                $language = str_replace('{' . $_k . '}', $_v, $language);
            }
        }
        return $language;
    }
}
开发者ID:haizhilin2013,项目名称:wuzhicms,代码行数:41,代码来源:common.func.php

示例7: manage

 public function manage()
 {
     $where = '';
     $keywords = '';
     $cid = intval($GLOBALS['cid']);
     if (isset($GLOBALS['keywords'])) {
         if (strtolower(CHARSET) == 'gbk') {
             $keywords = iconv('utf-8', 'gbk', $GLOBALS['keywords']);
         } else {
             $keywords = $GLOBALS['keywords'];
         }
         $keywords = sql_replace($keywords);
         $GLOBALS['keytype'] = 'keywords';
     }
     $show_dialog = 1;
     $form = load_class('form');
     $siteid = get_cookie('siteid');
     $r = $this->db->get_one('category', array('cid' => $cid));
     $where = array('keyid' => M, 'siteid' => $siteid, 'language' => $r['language']);
     $categorys = $this->db->get_list('category', $where, '*', 0, 200, 0, '', '', 'cid');
     foreach ($categorys as $_cid => $_value) {
         if ($_cid == $cid) {
             $categorys[$_cid]['selected'] = 'selected';
         }
     }
     include $this->template('relation_manage');
 }
开发者ID:nilm,项目名称:wuzhicms,代码行数:27,代码来源:relation.php

示例8: setFlow

 function setFlow()
 {
     $this->load->database();
     //存入cookie中
     $this->load->helper('cookie');
     $yk_id = get_cookie('id');
     //获取游客id
     set_cookie('flow', '100M');
     $count = $this->db->where('id', $yk_id)->from('user_session')->count_all_results();
     //插入之前先查查游客表该游客是否被记录了
     $session_data = array('id' => $yk_id, 'flow' => '100M');
     if ($count > 0) {
         //游客已经存入表中,只是更新
         unset($session_data['id']);
         $this->db->where('id', $yk_id)->update('user_session', $session_data);
     } else {
         $this->db->insert('user_session', $session_data);
     }
     $username = $this->session->userdata['username'];
     if ($username) {
         //如果用户已经注册,则还要存入用户表
         $this->db->where('username', $username)->update('userinfo', array('flow' => '100M'));
     }
     echo 'success';
 }
开发者ID:cygjs100crew,项目名称:cygjs_fr,代码行数:25,代码来源:Welcome.php

示例9: index

 public function index()
 {
     // global variable fungsi.
     $data = [];
     // ambil value untuk variable view.
     $data = $this->getVariable();
     // jika data login sudah ada. redirect lgsg.
     $userRole = '';
     // ambil peran user dulu.
     if ($this->session->userdata('userLogin') != '') {
         $userRole = $this->model_user->getUserDatum('peran', 'id', $this->session->userdata('userLogin'));
     } else {
         if (get_cookie('userLogin', true) != '') {
             $userRole = $this->model_user->getUserDatum('peran', 'id', get_cookie('userLogin', true));
         }
     }
     // jika peran user adalah admin.
     if ($userRole == 'admin_bau') {
         redirect('keuangan');
     } else {
         if ($userRole == 'dosen_chiefbau') {
             redirect('laporan');
         }
     }
     // load view.
     $this->load->view('includes/header_bau', $data);
     $this->load->view('nav/navbar_bau');
     $this->load->view('bau_placeholder');
     $this->load->view('includes/footer_bau', $data);
 }
开发者ID:RogueZero,项目名称:SDP2015,代码行数:30,代码来源:bau.php

示例10: space_count

 public function space_count()
 {
     $uid = (int) $this->input->get('uid');
     if ($this->uid && $uid && $this->uid != $uid) {
         // 记录访客信息
         $name = 'space-count-' . $this->uid . '-' . $uid;
         if (get_cookie($name)) {
             // 缓存期
         } else {
             // 查询今天是否访问过
             if ($this->db->where('uid', $this->uid)->where('spaceid', $uid)->where('DATEDIFF(from_unixtime(inputtime),now())=0')->count_all_results('space_access')) {
                 $this->db->where('uid', $this->uid)->where('spaceid', $uid)->update('space_access', array('inputtime' => SYS_TIME));
             } else {
                 $this->db->insert('space_access', array('uid' => $this->uid, 'spaceid' => $uid, 'content' => '', 'username' => $this->member['username'], 'inputtime' => SYS_TIME));
             }
             set_cookie($name, SYSTIME, 300);
             // 5分钟统计一次
         }
     }
     // 验证空间权限
     if ($this->_space_show($uid)) {
         $callback = isset($_GET['callback']) ? $_GET['callback'] : 'callback';
         exit($callback . '(' . json_encode(array('url' => dr_member_url('api/access', array('uid' => $uid)))) . ')');
     }
     exit('');
 }
开发者ID:Thebeautifullife,项目名称:yichunchengguan,代码行数:26,代码来源:Api.php

示例11: login

 public function login()
 {
     $this->load->model('user_model', 'User');
     $this->load->model('application_model', 'Application');
     if (get_cookie("eventribe-remember-token") != "") {
         $login = $this->User->get_user_from_token(get_cookie("eventribe-remember-token"));
         $this->session->set_userdata("user", $login);
         redirect(base_url() . 'router/org_picker/' . $login);
     } else {
         $this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[250]');
         $this->form_validation->set_rules('password', 'Password', 'required|min_length[5]|max_length[250]');
         //run validation
         if ($this->form_validation->run() == FALSE) {
             $this->session->set_flashdata('errors', validation_errors());
             redirect(base_url());
         } else {
             $login = $this->User->login($this->input->post('username'), $this->input->post('password'));
             if ($login != "" && $login != "invalid login parameters") {
                 $this->session->set_userdata("user", $login);
                 $this->session->set_userdata("username", $this->input->post("username"));
                 $this->session->set_userdata("password", $this->input->post("password"));
                 if ($this->input->post("remember") == 1) {
                     $token = $this->User->set_remember_me($this->input->post("username"), $this->input->post("password"));
                     $expire = time() + 2678400;
                     $cookie = array('name' => 'eventribe-remember-token', 'value' => $token, 'expire' => $expire, 'secure' => TRUE);
                     set_cookie($cookie);
                 }
                 redirect(base_url() . 'router/org_picker/' . $login);
             } else {
                 $this->session->set_flashdata('errors', $login);
                 redirect(base_url());
             }
         }
     }
 }
开发者ID:Omar-Faramawi,项目名称:codeigniter-eventrib-project,代码行数:35,代码来源:router.php

示例12: index

	function index(){
		//codeArmy v1.0
		if($this->session->userdata('username')) redirect('my-profile');
		$this->view_data['window_title'] = "CodeArmy | Home";
		$this->view_data['window_title'] = get_cookie('remember_me_token');
		$this->load->view('home_codearmy_view', $this->view_data);
	}
开发者ID:raminv80,项目名称:CodeArmy,代码行数:7,代码来源:home.php

示例13: update

 public function update($keyid, $posids, $datas, $cid = 0)
 {
     //$this->id.'-'.$this->cid
     if ($posids == '') {
         return true;
     }
     $formdata = $tmp = '';
     foreach ($datas as $key => $value) {
         if (in_array($key, array('title', 'thumb', 'url', 'remark', 'addtime', 'status'))) {
             $formdata[$key] = $value;
         } else {
             $tmp[$key] = $value;
         }
     }
     if (!empty($tmp)) {
         $formdata['attach'] = serialize($tmp);
     }
     $posid_str = implode(',', $posids);
     $this->db->delete('block_data', "`keyid`='{$keyid}' AND `blockid` NOT IN({$posid_str})");
     $siteid = get_cookie('siteid');
     foreach ($posids as $blockid) {
         if ($this->db->get_one('block_data', array('keyid' => $keyid, 'blockid' => $blockid))) {
             $formdata['blockid'] = $blockid;
             $this->db->update('block_data', $formdata, array('keyid' => $keyid, 'blockid' => $blockid));
         } else {
             $formdata['keyid'] = $keyid;
             $formdata['siteid'] = $siteid;
             $formdata['cid'] = $cid;
             $formdata['blockid'] = $blockid;
             $formdata['sort'] = '50';
             $this->db->insert('block_data', $formdata);
         }
     }
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:34,代码来源:block_api.class.php

示例14: edit

 /**
  * 修改公告
  */
 public function edit()
 {
     $id = intval($GLOBALS['id']);
     if (isset($GLOBALS['submit'])) {
         $formdata = $GLOBALS['form'];
         $formdata['title'] = remove_xss($formdata['title']);
         $formdata['note'] = remove_xss($formdata['note']);
         $formdata['addtime'] = SYS_TIME;
         $formdata['endtime'] = strtotime($GLOBALS['endtime']);
         $formdata['publisher'] = get_cookie('username');
         $formdata['css'] = 'color:#' . remove_xss(ltrim($GLOBALS['title_css'], '#') . ';' . $GLOBALS['font_weight']);
         $linkageid = $this->db->update('affiche', $formdata, array('id' => $id));
         MSG(L('operation success'), '?m=affiche&f=index&v=listing' . $this->su());
     } else {
         $show_formjs = 1;
         $form = load_class('form');
         load_function('admin');
         $endtime = SYS_TIME + 86400 * 30;
         $endtime = date('Y-m-d');
         $r = $this->db->get_one('affiche', array('id' => $id));
         $styles = style($r['css']);
         //color:#ff0000;font-weight:bold
         $font_weight = $styles['font-weight'];
         $color = $styles['color'];
         include $this->template('edit');
     }
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:30,代码来源:index.php

示例15: index

 public function index()
 {
     if (IS_POST) {
         if (get_cookie('admin_login')) {
             $this->admin_msg(lang('167'));
         }
         if (SITE_ADMIN_CODE && !$this->check_captcha('code')) {
             $this->admin_msg(lang('168'));
         }
         $uid = $this->member_model->admin_login($this->input->post('username', TRUE), $this->input->post('password', TRUE));
         if ($uid > 0) {
             $url = $this->input->get('backurl') ? urldecode($this->input->get('backurl')) : dr_url('home');
             $url = pathinfo($url);
             $url = $url['basename'] ? $url['basename'] : dr_url('home/index');
             $this->admin_msg(lang('042'), $url, 1);
         }
         if ($uid == -1) {
             $this->admin_msg(lang('043'));
         } elseif ($uid == -2) {
             $this->admin_msg(lang('044'));
         } elseif ($uid == -3) {
             $this->admin_msg(lang('045'));
         } elseif ($uid == -4) {
             $this->admin_msg(lang('046'));
         } else {
             $this->admin_msg(lang('047'));
         }
     }
     $this->template->assign('username', $this->member['username']);
     $this->template->display('login.html');
 }
开发者ID:xxjuan,项目名称:php-coffee,代码行数:31,代码来源:Login.php


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