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


PHP zotop::cookie方法代码示例

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


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

示例1: globalid

 public static function globalid()
 {
     $globalid = zotop::cookie('file.globalid');
     if (empty($globalid)) {
         $globalid = TIME . rand(100, 10000);
         $globalid = md5($globalid);
         zotop::cookie('file.globalid', $globalid);
     }
     return $globalid;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:10,代码来源:form.php

示例2: indexAction

 public function indexAction()
 {
     $user = zotop::model('zotop.user');
     if (form::isPostBack()) {
         $post = array();
         $post['username'] = request::post('username');
         $post['password'] = request::post('password');
         $post['logintime'] = time();
         zotop::cookie('admin.username', $post['username'], 3600);
         if (empty($post['username'])) {
             msg::error(zotop::t('登陆失败,请输入登陆账户名称'));
         }
         if (empty($post['password'])) {
             msg::error(zotop::t('登陆失败,请输入登陆账户密码'));
         }
         if (!$user->isValidUserName($post['username'])) {
             msg::error(zotop::t('登陆失败,请输入有效的账户名称'));
         }
         if (!$user->isValidPassword($post['password'])) {
             msg::error(zotop::t('登陆失败,请输入有效的账户密码'));
         }
         //读取用户
         $data = $user->read(array('username', '=', $post['username']));
         //验证
         if ($data == false) {
             msg::error(zotop::t('账户名称`{$username}`不存在,请检查是否输入有误!', array('username' => $post['username'])));
         }
         if ($user->password($post['password']) != $data['password']) {
             msg::error(zotop::t('账户密码`{$password}`错误,请检查是否输入有误!', array('password' => $post['password'])));
         }
         //用户登入
         $user->login();
         //跳转
         msg::success('登陆成功,系统正在加载中', url::current(), 2);
     }
     if (!empty($this->user)) {
         $this->redirect('zotop/index');
     }
     $data = $user->read(array('username', '=', 'admin'));
     $page = new page();
     $page->title = '系统登陆';
     $page->body = array('class' => 'login');
     $page->addScript('$this/js/login.js');
     $page->display();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:45,代码来源:login.php

示例3: onDefault

 public function onDefault()
 {
     if (form::isPostBack()) {
         $post = array();
         $post['username'] = request::post('username');
         $post['password'] = request::post('password');
         $post['logintime'] = time();
         zotop::cookie('admin.username', $post['username'], 3600);
         if (empty($post['username'])) {
             msg::error('登陆失败', zotop::t('请输入登陆账户名称'));
         }
         if (empty($post['password'])) {
             msg::error('登陆失败', zotop::t('请输入登陆账户密码'));
         }
         $user = zotop::model('zotop.user');
         $data = $user->read(array('username', '=', $post['username']));
         if ($data == false) {
             msg::error('登陆失败', zotop::t('账户名称`{$username}`不存在,请检查是否输入有误!', array('username' => $post['username'])));
         }
         if ($user->password($post['password']) != $data['password']) {
             msg::error('登陆失败', zotop::t('账户密码`{$password}`错误,请检查是否输入有误!', array('password' => $post['password'])));
         }
         //更新
         $user->refresh();
         //登陆成功
         zotop::user($data);
         msg::success('登陆成功', '登陆成功,系统正在加载中', 'reload', 2);
     }
     if (zotop::user()) {
         zotop::redirect('zotop/index');
     }
     $header['title'] = '用户登录';
     $header['js'] = url::module() . '/admin/js/login.js';
     $header['body']['class'] = "login";
     page::header($header);
     block::header(array('id' => 'LoginWindow', 'title' => '用户登录'));
     form::header(array('title' => '', 'description' => '请输入用户名和密码', 'class' => 'small'));
     form::field(array('type' => 'text', 'label' => zotop::t('帐 户(U)'), 'name' => 'username', 'value' => zotop::cookie('admin.username'), 'valid' => 'required:true'));
     form::field(array('type' => 'password', 'label' => zotop::t('密 码(P)'), 'name' => 'password', 'value' => '', 'valid' => 'required:true'));
     form::buttons(array('type' => 'submit', 'value' => '登 陆'), array('type' => 'button', 'name' => 'options', 'value' => '选 项'));
     form::footer();
     block::footer();
     page::footer();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:44,代码来源:login.php

示例4: getPage

 /**
  * 返回limit限制的数据,用于带分页的查询数据
  *
  * @param $page int 页码
  * @param $pagesize int 每页显示条数
  * @param $num int|bool 总条数|缓存查询条数,$toal = (false||0) 不缓存查询
  * @return mixed
  */
 public function getPage($page = 0, $pagesize = 15, $num = false)
 {
     $page = $page <= 0 ? (int) $_GET['page'] : $page;
     $page = $page <= 0 ? 1 : $page;
     //获取查询参数
     $sqlBuilder = $this->sqlBuilder($sql);
     if (is_numeric($num) && $num > 0) {
         $total = $num;
     } else {
         $hash = md5(serialize($sqlBuilder['where']));
         if ($page == 1 || $num == true || !is_numeric(zotop::cookie($hash))) {
             //获取符合条件数据条数
             $total = $this->count($sqlBuilder['where']);
             zotop::cookie($hash, $total);
         } else {
             $total = zotop::cookie($hash);
         }
     }
     //zotop::dump($this->lastsql());
     //计算$offset
     $offset = intval($page) > 0 ? (intval($page) - 1) * intval($pagesize) : 0;
     //设置limit
     $this->sqlBuilder($sqlBuilder);
     $this->limit($pagesize, $offset);
     //获取指定条件的数据
     $data = $this->getAll();
     return array('data' => (array) $data, 'page' => intval($page), 'pagesize' => intval($pagesize), 'total' => intval($total));
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:36,代码来源:database.php

示例5: user

 /**
  * 读取存储的用户信息
  *
  */
 public static function user($key = '', $application = '')
 {
     $user = array();
     $application = empty($application) ? APP_NAME : $application;
     $cookieName = 'zotop.user.' . $application;
     if (empty($user)) {
         $user = zotop::cookie($cookieName);
         $user = is_array($user) ? array_change_key_case($user) : array();
     }
     if ($key === null) {
         return zotop::cookie($cookieName, null);
     }
     if (empty($key)) {
         return empty($user) ? false : $user;
     }
     if (is_array($key)) {
         $user = array_merge($user, array_change_key_case($key));
         return zotop::cookie($cookieName, $user);
     }
     $value = $user[strtolower($key)];
     if (isset($value)) {
         return $value;
     }
     return null;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:29,代码来源:zotop.php

示例6: user

 public static function user($key = '')
 {
     $user = array();
     if (empty($user)) {
         $user = zotop::cookie('zotop.user');
         $user = is_array($user) ? array_change_key_case($user) : array();
     }
     if ($key === null) {
         return zotop::cookie('zotop.user', null);
     }
     if (empty($key)) {
         return empty($user) ? false : $user;
     }
     if (is_array($key)) {
         $user = array_merge($user, array_change_key_case($key));
         return zotop::cookie('zotop.user', $user);
     }
     $value = $user[strtolower($key)];
     if (isset($value)) {
         return $value;
     }
     return null;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:23,代码来源:zotop.php

示例7: login

 /**
  * 写入登陆信息
  *
  */
 public function login($data = array())
 {
     $username = $data['username'];
     $password = $data['password'];
     if (empty($username)) {
         $this->error(zotop::t('请输入登陆账户名称'));
         return false;
     }
     if (empty($password)) {
         $this->error(zotop::t('请输入登陆账户密码'));
         return false;
     }
     if (!$this->isValidUserName($username)) {
         $this->error(zotop::t('请输入有效的账户名称'));
         return false;
     }
     if (!$this->isValidPassword($password)) {
         $this->error(zotop::t('请输入有效的账户密码'));
         return false;
     }
     //检查账户是否存在
     if (!$this->isExist(array('username', '=', $username))) {
         $this->error(zotop::t('账户`{$username}`不存在,请检查是否输入有误!', $data));
         return false;
     }
     //加密密码
     $password = $this->password($password);
     //读取用户
     $user = $this->db()->where(array('username', '=', $username))->where(array('password', '=', $password))->getRow();
     //验证
     if ($user == false) {
         $this->error(zotop::t('账户密码`{$password}`错误,请检查是否输入有误!', $data));
         return false;
     }
     //刷新信息
     $this->refresh($user['id']);
     //记录用户数据
     zotop::user($user);
     zotop::cookie('username', $username, 3600);
     zotop::log('login', zotop::t('用户 <b>{$username}</b> 于 {$time} 登陆成功', array('username' => $username, 'time' => TIME)));
     return true;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:46,代码来源:user.php

示例8: array

		$('button[name=options]').click(function(){
			location.href = "<?php 
echo zotop::url('site://');
?>
";
		});
	});
</script>
<div id="topbar">
	<a href="<?php 
echo zotop::url('site://');
?>
">网站首页</a>
	<b>|</b>
	<a href="javascript:void(0);" class="addFavorite">加入收藏夹</a>
	<b>|</b>
	<a href="<?php 
echo zotop::url('zotop/login/shortcut', array('title' => url::encode($title), 'url' => url::encode(url::location())));
?>
">设为桌面图标</a>		
</div>

<?php 
box::header(array('title' => $title, 'icon' => 'user', 'action' => ''));
form::header(array('title' => '', 'description' => '请输入您的帐户和密码登录', 'class' => 'small'));
form::field(array('type' => 'text', 'label' => zotop::t('帐 户'), 'name' => 'username', 'value' => zotop::cookie('username'), 'valid' => 'required:true'));
form::field(array('type' => 'password', 'label' => zotop::t('密 码'), 'name' => 'password', 'value' => '', 'valid' => 'required:true'));
form::buttons(array('type' => 'submit', 'value' => '登录'), array('type' => 'button', 'name' => 'options', 'value' => '取消'));
form::footer();
box::footer();
$this->footer();
开发者ID:dalinhuang,项目名称:zotop,代码行数:31,代码来源:index.php


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