本文整理匯總了PHP中Session::is_set方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::is_set方法的具體用法?PHP Session::is_set怎麽用?PHP Session::is_set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Session
的用法示例。
在下文中一共展示了Session::is_set方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: check_admin
public function check_admin()
{
if (!Session::is_set('lfy_name') or !Session::is_set('lfy') or $_SESSION['lfy'] != md5('lfy000')) {
$this->redirect('index/index');
exit;
}
}
示例2: listInformationColumn
/**
+----------------------------------------------------------
* 返回後台資訊列表
+----------------------------------------------------------
*/
public function listInformationColumn()
{
if (!Session::is_set("systemId")) {
header("Content-type: text/html; charset=utf-8");
echo '<script>alert("您還沒有登錄!");location.href="Admin/loginInit";</script>';
} else {
$informationColumn = M("information_column");
$title = $_REQUEST["title"];
if (!empty($title)) {
$condition["title"] = array("like", "%" . $title . "%");
}
$source = $_REQUEST["source"];
if (!empty($source)) {
$condition["source"] = $source;
}
$column = $_REQUEST["column"];
if (!empty($column)) {
$condition["column"] = $column;
}
$status = $_REQUEST["status"];
if (!empty($status)) {
$condition["status"] = $status;
}
$count = $informationColumn->where($condition)->count();
import("ORG.Util.Page");
$Page = new Page($count, 10);
$foot = $Page->show();
$list = $informationColumn->where($condition)->order('seq desc,update_time desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
// 查詢數據
$this->assign('list', $list);
$this->assign('foot', $foot);
$this->display();
}
}
示例3: SignIn
function SignIn($row)
{
Module::Module($row);
if (User::is_login()) {
if ($data = Session::get('user_data') and $data['home_page']) {
Url::redirect_url($data['home_page']);
} else {
Url::redirect('home');
}
} else {
// xoa toan bo du lieu dang co truoc khi dang nhap
if (Session::is_set('user_id')) {
$id = Session::get('user_id');
DB::update('account', array('last_online_time' => time()), 'id=\'' . $id . '\'');
setcookie('user_id', "", time() - 3600);
Session::destroy('user_id');
}
//if(URL::get("m")== "mobile"){
// require_once 'forms/mlogin.php';
// $this->add_form(new SignInmForm);
//}else{
require_once 'forms/sign_in.php';
$this->add_form(new SignInForm());
//}
}
}
示例4: getCurrent
static function getCurrent()
{
if (!Session::is_set(self::SESSION_LANGUAGE_PATH)) {
self::initDefault();
}
return Session::get(self::SESSION_LANGUAGE_PATH);
}
示例5: listActivityComment
/**
+----------------------------------------------------------
* 返回用戶列表
+----------------------------------------------------------
*/
public function listActivityComment()
{
if (!Session::is_set("systemId")) {
header("Content-type: text/html; charset=utf-8");
echo '<script>alert("您還沒有登錄!");location.href="/Admin/loginInit";try{window.event.returnValue=false; }catch(e){}</script>';
} else {
$vactivity_comment = M("vactivity_comment");
$user_name = $_REQUEST["user_name"];
if (!empty($user_name)) {
$condition["user_name"] = array("like", "%" . $user_name . "%");
}
$activity_title = $_REQUEST["activity_title"];
if (!empty($activity_title)) {
$condition["activity_title"] = array("like", "%" . $activity_title . "%");
}
$content = $_REQUEST["content"];
if (!empty($content)) {
$condition["content"] = array("like", "%" . $content . "%");
}
$count = $vactivity_comment->where($condition)->count();
import("ORG.Util.Page");
$Page = new Page($count, 10);
$foot = $Page->show();
$list = $vactivity_comment->where($condition)->order('insert_time desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
// 查詢數據
$this->assign('list', $list);
$this->assign('foot', $foot);
$this->display();
}
}
示例6: testClear
function testClear()
{
Session::clear();
$this->assertFalse(Session::is_set("/prova"), "La variabile prova e' gia' impostata!!");
Session::set("/prova", "ok");
$this->assertTrue(Session::is_set("/prova"), "la chiave prova non e' stata trovata.");
$this->assertTrue(Session::get("/prova"), "ok", "Il valore della chiave non corrisponde!!");
Session::clear();
$this->assertFalse(Session::is_set("/prova"), "la chiave prova e' stata trovata.");
}
示例7: getNodeName
function getNodeName($id)
{
if (Session::is_set('nodeNameList')) {
$name = Session::get('nodeNameList');
return $name[$id];
}
$Group = D("Node");
$list = $Group->getField('id,name');
$name = $list[$id];
Session::set('nodeNameList', $list);
return $name;
}
示例8: getInfoByCodeFromCodeDict
/**
* 通過條碼字典獲取條碼信息
*
* @param $code
*/
private function getInfoByCodeFromCodeDict($code)
{
if (!Session::is_set('codeparm') || !Session::is_set('codedict')) {
return false;
}
$codeparm = Session::get('codeparm');
$codedict = Session::get('codedict');
$codeinfo = array();
foreach ($codeparm as $key => $value) {
$s = (int) $value["start"] - 1;
$l = $value["length"];
$data = $codedict[$key][substr($code, $s, $l)];
if ($data == '' || $data == null) {
continue;
}
switch ($key) {
case '品名':
$codeinfo['goodsName'] = $data;
break;
case '型號':
$codeinfo['spec'] = $data;
break;
case '電流':
$codeinfo['current1'] = $data;
break;
case '電壓':
$codeinfo['voltage1'] = $data;
break;
case '方向':
$codeinfo['direct'] = $data;
break;
case '常數':
$codeinfo['constant'] = $data;
break;
case '等級':
$codeinfo['grade'] = $data;
break;
case '生產廠商':
$codeinfo['madeIn'] = $data;
break;
case '生產日期':
$codeinfo['madeDate'] = $data;
break;
}
}
system_out(print_r($codeinfo, true));
if (sizeof($codeinfo)) {
$codeinfo['code'] = $code;
return $codeinfo;
} else {
return false;
}
}
示例9: logout
public function logout()
{
if (Session::is_set(C('USER_AUTH_KEY'))) {
Session::clear();
$this->assign('jumpUrl', __URL__ . '/login');
$this->success("注銷成功!");
} else {
$this->assign('jumpUrl', __URL__ . '/login');
$this->error('已經注銷!');
}
$this->forward();
}
示例10: add
public function add()
{
$dao = D("Node");
if (Session::is_set('currentNodeId')) {
$vo = $dao->getById(Session::get('currentNodeId'));
$this->assign('parentNode', $vo['name']);
$this->assign('level', $vo['level'] + 1);
$this->assign('pid', $vo['id']);
} else {
$this->assign('level', 1);
}
$this->display();
}
示例11: checkAdminUser
public function checkAdminUser()
{
if (!Session::is_set("systemId")) {
$json["success"] = false;
$json["msg"] = "請您先登錄";
} else {
$condition["id"] = Session::get("systemId");
$admin_user = M("admin_user");
$result = $admin_user->where($condition)->find();
$json["success"] = true;
$json["user_name"] = $result["user_name"];
}
$this->ajaxReturn($json);
}
示例12: getGroupName
function getGroupName($id)
{
if ($id == 0) {
return '無上級組';
}
if (Session::is_set('groupName')) {
$name = Session::get('groupName');
return $name[$id];
}
$Group = D("Group");
$list = $Group->getFields('id,name');
$name = $list[$id];
Session::set('groupName', $list);
return $name;
}
示例13: listUser
/**
+----------------------------------------------------------
* 返回用戶列表
+----------------------------------------------------------
*/
public function listUser()
{
if (!Session::is_set("systemId")) {
header("Content-type: text/html; charset=utf-8");
echo '<script>alert("您還沒有登錄!");location.href="Admin/loginInit";try{window.event.returnValue=false; }catch(e){}</script>';
} else {
$User = M("User");
$user_name = $_REQUEST["user_name"];
if (!empty($user_name)) {
$condition["user_name"] = array("like", "%" . $user_name . "%");
}
$user_type1 = $_REQUEST["user_type1"];
if (!empty($user_type1)) {
$condition["user_type1"] = $user_type1;
}
$user_type2 = $_REQUEST["user_type2"];
if (!empty($user_type2)) {
$condition["user_type2"] = $user_type2;
}
$status = $_REQUEST["status"];
if (!empty($status)) {
$condition["status"] = $status;
}
$activite_flag = $_REQUEST["activite_flag"];
if (!empty($activite_flag)) {
$condition["activite_flag"] = $activite_flag;
}
$freeze_flag = $_REQUEST["freeze_flag"];
if (!empty($freeze_flag)) {
if ($freeze_flag == "已凍結") {
$condition["freeze_flag"] = $freeze_flag;
} else {
$condition["freeze_flag"] = array('neq', "已凍結");
}
}
$count = $User->where($condition)->count();
import("ORG.Util.Page");
$Page = new Page($count, 10);
$foot = $Page->show();
$list = $User->where($condition)->order('update_time desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
// 查詢數據
$this->assign('list', $list);
$this->assign('foot', $foot);
$this->display();
}
}
示例14: update
public function update()
{
if (!isset($_POST['author']) or !isset($_POST['content'])) {
alert('非法操作!', 3);
}
//讀取數據庫和緩存
$pl = M('guestbook');
$config = F('basic', '', './Web/Conf/');
//相關判斷
if (Session::is_set('posttime')) {
$temp = Session::get('posttime') + $config['postovertime'];
if (time() < $temp) {
// echo "請不要連續發布!";
alert('請不要連續發布!', U('Guestbook/index'));
exit;
}
}
//準備工作
if ($config['bookoff'] == 0) {
$data['status'] = 0;
}
$data['author'] = htmlspecialchars($_POST['author']);
$data['content'] = htmlspecialchars(trim($_POST['content']));
$data['email'] = htmlspecialchars(trim($_POST['email']));
$data['tel'] = htmlspecialchars(trim($_POST['tel']));
$data['addtime'] = date('Y-m-d H:i:s');
//處理數據
// dump($data)
if ($pl->add($data)) {
Session::set('posttime', time());
if ($config['bookoff'] == 0) {
// echo '發布成功,留言需要管理員審核!';
alert('操作成功!', U('Guestbook/index'));
exit;
} else {
// echo '發布成功!';
alert('發布成功!', U('Guestbook/index'));
exit;
}
} else {
// echo '發布失敗!';
alert('發布失敗!', U('Guestbook/index'));
exit;
}
}
示例15: update
public function update()
{
//輸出gb2312碼,ajax默認轉的是utf-8
header("Content-type: text/html; charset=utf-8");
if (!isset($_POST['author']) or !isset($_POST['content'])) {
alert('非法操作!', 3);
}
//讀取數據庫和緩存
$pl = M('guestbook');
$config = F('basic', '', './Web/Conf/');
//相關判斷
if (Session::is_set('posttime')) {
$temp = Session::get('posttime') + $config['postovertime'];
if (time() < $temp) {
echo "請不要連續發布!";
exit;
}
}
//準備工作
if ($config['bookoff'] == 0) {
$data['status'] = 0;
}
//先解密js的escape
$data['author'] = htmlspecialchars(unescape($_POST['author']));
$data['content'] = htmlspecialchars(trim(unescape($_POST['content'])));
$data['title'] = htmlspecialchars(trim(unescape($_POST['title'])));
$data['tel'] = htmlspecialchars(trim(unescape($_POST['tel'])));
$data['ip'] = remove_xss(htmlentities(get_client_ip()));
$data['addtime'] = date('Y-m-d H:i:s');
//處理數據
if ($pl->add($data)) {
Session::set('posttime', time());
if ($config['bookoff'] == 0) {
echo '發布成功,留言需要管理員審核!';
exit;
} else {
echo '發布成功!';
exit;
}
} else {
echo '發布失敗!';
exit;
}
}