本文整理汇总了PHP中Loader::session方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::session方法的具体用法?PHP Loader::session怎么用?PHP Loader::session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::session方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defined
<?php
/**
* @author Tongle Xu <xutongle@gmail.com> 2012-5-31
* @copyright Copyright (c) 2003-2103 yuncms.net
* @license http://leaps.yuncms.net
* @version $Id: AttachmentsController.php 626 2013-07-29 04:04:53Z 85825770@qq.com $
*/
defined('IN_YUNCMS') or exit('No permission resources.');
Loader::session();
error_reporting(E_ERROR);
class AttachmentsController
{
private $att_db;
public function __construct()
{
Loader::helper('attachment:global');
$this->upload_url = C('attachment', 'upload_url');
$this->upload_path = C('attachment', 'upload_path');
$this->imgext = array('jpg', 'gif', 'png', 'bmp', 'jpeg');
$this->userid = cookie('userid') ? cookie('userid') : 0;
$this->isadmin = isset($_SESSION['roleid']) ? 1 : 0;
$this->groupid = cookie('_groupid') ? cookie('_groupid') : 1;
$this->admin_username = cookie('admin_username');
}
/**
* 常规上传
*/
public function upload()
{
$grouplist = S('member/grouplist');
示例2: public_qq_login
/**
* 用QQ账户登录
*/
public function public_qq_login()
{
$config = C('sns', 'qq');
OpenSDK_Tencent_SNS2::init($config['app_key'], $config['app_secret']);
Loader::session();
if (isset($_GET['callback']) && trim($_GET['callback'])) {
$access_token = $sdk->getAccessToken($_REQUEST["oauth_token"], $_SESSION["secret"], $_REQUEST["oauth_vericode"]);
$me = $sdk->get_user_info($access_token["oauth_token"], $access_token["oauth_token_secret"], $access_token["openid"]);
if (CHARSET != 'utf-8') {
$me['nickname'] = iconv('utf-8', CHARSET, $me['nickname']);
}
if (!empty($access_token["openid"])) {
// 检查connect会员是否绑定,已绑定直接登录,未绑定提示注册/绑定页面
$member_bind = Loader::model('member_bind_model')->get_one(array('connectid' => $access_token["openid"], 'form' => 'sina'));
if (!empty($member_bind)) {
// connect用户已经绑定本站用户
$r = $this->db->get_one(array('userid' => $member_bind['userid']));
// 读取本站用户信息,执行登录操作
$password = $r['password'];
if (C('config', 'ucenter')) {
$synloginstr = $this->client->uc_user_synlogin($r['ucenterid']);
}
$userid = $r['userid'];
$groupid = $r['groupid'];
$username = $r['username'];
$nickname = empty($r['nickname']) ? $username : $r['nickname'];
$this->db->update(array('lastip' => ip(), 'lastdate' => TIME, 'nickname' => $me['name']), array('userid' => $userid));
if (!$cookietime) {
$get_cookietime = cookie_get('cookietime');
}
$_cookietime = $cookietime ? intval($cookietime) : ($get_cookietime ? $get_cookietime : 0);
$cookietime = $_cookietime ? TIME + $_cookietime : 0;
$yuncms_auth_key = md5(C('config', 'auth_key') . $this->http_user_agent);
$yuncms_auth = String::authcode($userid . "\t" . $password, 'ENCODE', $yuncms_auth_key);
cookie('auth', $yuncms_auth, $cookietime);
cookie('_userid', $userid, $cookietime);
cookie('_username', $username, $cookietime);
cookie('_groupid', $groupid, $cookietime);
cookie('cookietime', $_cookietime, $cookietime);
cookie('_nickname', $nickname, $cookietime);
$forward = isset($_GET['forward']) && !empty($_GET['forward']) ? $_GET['forward'] : 'index.php?app=member&controller=index';
showmessage(L('login_success') . $synloginstr, $forward);
} else {
// $sdk->add_feeds($access_token["oauth_token"],
// $access_token["oauth_token_secret"],
// $access_token["openid"]);
unset($_SESSION["secret"]);
// 弹出绑定注册页面
$_SESSION['connectid'] = $access_token["openid"];
$_SESSION['token'] = $access_token["oauth_token"];
$_SESSION['token_secret'] = $access_token["oauth_token_secret"];
$connect_username = $me['nickname'];
$connect_nick = $me['nickname'];
cookie('open_name', $me['nickname']);
cookie('open_from', 'qq');
if (isset($_GET['bind'])) {
showmessage(L('bind_success'), 'index.php?app=member&controller=account&action=bind&t=1');
}
include template('member', 'connect');
}
} else {
unset($_SESSION["secret"]);
showmessage(L('login_failure'), 'index.php?app=member&controller=passport&action=login');
}
} else {
OpenSDK_Tencent_SNS2::setParam(OpenSDK_Tencent_SNS2::ACCESS_TOKEN, null);
OpenSDK_Tencent_SNS2::setParam(OpenSDK_Tencent_SNS2::REFRESH_TOKEN, null);
$callback = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$url = OpenSDK_Tencent_SNS2::getAuthorizeURL(SITE_URL, 'code', 'state', 'default', 'get_other_info,get_info');
Header("HTTP/1.1 301 Moved Permanently");
Header('Location: ' . $url);
}
}
示例3: showmessage
/**
* 提示信息页面跳转,跳转地址如果传入数组,页面会提示多个地址供用户选择,默认跳转地址为数组的第一个值,时间为5秒。
* showmessage('登录成功', array('默认跳转地址'=>'http://www.yuncms.net'));
*
* @param string $msg 提示信息
* @param mixed(string/array) $url_forward 跳转地址
* @param int $ms 跳转等待时间
*/
function showmessage($msg, $url_forward = 'goback', $ms = 1250, $dialog = '', $returnjs = '')
{
if ($ms == 301) {
Loader::session();
$_SESSION['msg'] = $msg;
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: {$url_forward}");
exit;
}
if (defined('IN_ADMIN')) {
include Web_Admin::view('showmessage', 'admin');
} else {
include template('yuncms', 'message');
}
if (isset($_SESSION['msg'])) {
unset($_SESSION['msg']);
}
exit;
}
示例4: creat_code
/**
* 生成随机验证码。
*/
public function creat_code()
{
$this->response = String::rand_string(4);
Loader::session();
$_SESSION['code'] = strtolower($this->response);
}