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


PHP SESSION函数代码示例

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


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

示例1: isConnected

function isConnected($URL = FALSE)
{
    if (!SESSION("ZanUser")) {
        redirect($URL);
    }
    return TRUE;
}
开发者ID:pokaxperia,项目名称:emus-itdp,代码行数:7,代码来源:sessions.php

示例2: cacheSession

/**
 * Sessions Helper
 *
 * 
 *
 * @package		ZanPHP
 * @subpackage	core
 * @category	helpers
 * @author		MilkZoft Developer Team
 * @link		http://www.zanphp.com/documentation/en/helpers/security_helper
 */
function cacheSession($cacheID)
{
    if (SESSION("ZanUser")) {
        return $cacheID . "." . SESSION("ZanUser");
    }
    return $cacheID . ".guest";
}
开发者ID:no2key,项目名称:MuuCMS,代码行数:18,代码来源:sessions.php

示例3: index

 public function index()
 {
     if ($this->_get('token') != session('token')) {
         $this->error('非法操作');
     }
     $token_open = M('token_open')->field('queryname')->where(array('token' => session('token')))->find();
     //dump($token_open);
     if (!strpos($token_open['queryname'], 'api')) {
         $this->error('您还开启该模块的使用权,请到功能模块中添加', U('Function/index', array('token' => session('token'), 'id' => session('wxid'))));
     }
     $data = D('Api');
     $this->assign('api', $data->where(array('token' => session('token'), 'uid' => session('uid')))->find());
     if (IS_POST) {
         $_POST['uid'] = SESSION('uid');
         $_POST['token'] = SESSION('token');
         //if(empty($_POST['home']))unset($_POST['home']);
         if ($data->create()) {
             if ($data->add()) {
                 $this->success('操作成功');
             } else {
                 $this->error('服务器繁忙,请稍候再试');
             }
         } else {
             $this->error($data->getError());
         }
     } else {
         $this->display();
     }
 }
开发者ID:zhaoshengloveqingqing,项目名称:Wechat,代码行数:29,代码来源:ApiAction.class.php

示例4: _initialize

 public function _initialize()
 {
     if (!SESSION('?ADMIN_STATE')) {
         $this->redirect('Admin/Login/index');
     }
     $this->webTitle = '后台管理';
 }
开发者ID:highestgoodlikewater,项目名称:lexiang,代码行数:7,代码来源:CommonAction.class.php

示例5: editOrSave

 private function editOrSave($action)
 {
     $validations = array("title" => "required", "URL" => "ping");
     if (POST("code")) {
         unset($validations["URL"]);
     }
     $data = array("ID_User" => SESSION("ZanUserID"), "Start_Date" => now(4), "End_Date" => now(4) + 2419200);
     if ($action === "edit") {
         $this->Data->ignore("banner");
     }
     $this->data = $this->Data->proccess($data, $validations);
     if (isset($this->data["error"])) {
         return $this->data["error"];
     }
     if (FILES("image", "name")) {
         if (POST("banner")) {
             @unlink(POST("banner"));
         }
         $dir = "www/lib/files/images/ads/";
         $this->Files = $this->core("Files");
         $this->data["Banner"] = $this->Files->uploadImage($dir, "image", "normal");
         if (!$this->data["Banner"]) {
             return getAlert("Upload error");
         }
     } else {
         if (!isset($this->data["Code"])) {
             return getAlert("You need to upload an image or write the ad code");
         }
     }
 }
开发者ID:no2key,项目名称:MuuCMS,代码行数:30,代码来源:ads.php

示例6: editOrSave

 private function editOrSave($action)
 {
     $validations = array("exists" => array("Slug" => slug(POST("title", "clean")), "Year" => date("Y"), "Month" => date("m"), "Day" => date("d"), "Language" => POST("language")), "title" => "required", "content" => "required");
     $this->categories = POST("categories");
     $this->tags = POST("tags");
     $this->URL = PATH("blog/" . date("Y")) . "/" . date("m") . "/" . date("d") . "/" . slug(POST("title", "clean"));
     $this->muralExist = POST("mural_exist");
     $this->Files = $this->core("Files");
     $this->mural = FILES("mural");
     if ($this->mural["name"] !== "") {
         $dir = "www/lib/files/images/mural/";
         $this->mural = $this->Files->uploadImage($dir, "mural", "mural");
         if (is_array($this->mural)) {
             return $this->mural["alert"];
         }
     }
     $dir = "www/lib/files/images/blog/";
     $this->image = $this->Files->uploadImage($dir, "image", "resize", TRUE, TRUE, FALSE);
     $data = array("ID_User" => SESSION("ZanUserID"), "ID_URL" => 1, "Slug" => slug(POST("title", "clean")), "Content" => POST("content", "clean"), "Author" => SESSION("ZanUser"), "Year" => date("Y"), "Month" => date("m"), "Day" => date("d"), "Image_Small" => isset($this->image["small"]) ? $this->image["small"] : NULL, "Image_Medium" => isset($this->image["medium"]) ? $this->image["medium"] : NULL, "Pwd" => POST("pwd") ? POST("pwd", "encrypt") : NULL, "Start_Date" => now(4), "Text_Date" => now(2));
     $this->Data->ignore(array("categories", "tags", "mural_exists", "mural", "pwd", "category", "language_category", "application", "mural_exist"));
     $this->data = $this->Data->proccess($data, $validations);
     if (isset($this->data["error"])) {
         return $this->data["error"];
     }
 }
开发者ID:no2key,项目名称:MuuCMS,代码行数:25,代码来源:tags.php

示例7: getOnlineUsers

function getOnlineUsers()
{
    global $Load;
    $Db = $Load->core("Db");
    $date = time();
    $time = 10;
    $time = $date - $time * 60;
    $IP = getIP();
    $user = SESSION("ZanUser");
    $Db->deleteBySQL("Start_Date < {$time}", "users_online_anonymous");
    $Db->deleteBySQL("Start_Date < {$time}", "users_online");
    if ($user) {
        $users = $Db->findBy("User", $user, "users_online");
        if (!$users) {
            $Db->insert("users_online", array("User" => $user, "Start_Date" => $date));
        } else {
            $Db->updateBySQL("users_online", "Start_Date = '{$date}' WHERE User = '{$user}'");
        }
    } else {
        $users = $Db->findBy("IP", $IP, "users_online_anonymous");
        if (!$users) {
            $Db->insert("users_online_anonymous", array("IP" => $IP, "Start_Date" => $date));
        } else {
            $Db->updateBySQL("users_online", "Start_Date = '{$date}' WHERE IP = '{$IP}'");
        }
    }
}
开发者ID:no2key,项目名称:MuuCMS,代码行数:27,代码来源:users.php

示例8: insert

 public function insert()
 {
     $tj = M('Huadianposter')->where(array('token' => SESSION('token'), 'subestatename' => $_POST['subestatename']))->count();
     if ($tj == 0) {
         $this->all_insert();
     } else {
         $this->error('操作失败,已有记录!请删除原有分类海报!', U(MODULE_NAME . '/index'));
     }
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:9,代码来源:HuadianposterAction.class.php

示例9: insert

 public function insert()
 {
     $tj = M('Cosmetology')->where(array('token' => SESSION('token')))->count();
     if ($tj == 0) {
         $this->all_insert();
     } else {
         $this->error('操作失败', U(MODULE_NAME . '/index'));
     }
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:9,代码来源:CosmetologyAction.class.php

示例10: editOrSave

 private function editOrSave()
 {
     $validations = array("title" => "required", "URL" => "ping");
     $data = array("ID_User" => SESSION("ZanUserID"));
     $this->data = $this->Data->proccess($data, $validations);
     if (isset($this->data["error"])) {
         return $this->data["error"];
     }
 }
开发者ID:no2key,项目名称:MuuCMS,代码行数:9,代码来源:links.php

示例11: getTwitterUser

 function getTwitterUser($oauthToken, $Twitter)
 {
     $Twitter->setToken($oauthToken);
     $accessToken = $Twitter->getAccessToken();
     $Twitter->setToken($accessToken->oauth_token, $accessToken->oauth_token_secret);
     SESSION("ZanUserServiceAccessToken", $accessToken->oauth_token);
     SESSION("ZanUserServiceAccessTokenSecret", $accessToken->oauth_token_secret);
     $data = $Twitter->get_accountVerify_credentials();
     return array("service" => "twitter", "serviceID" => $data->id, "username" => $data->screen_name, "name" => $data->name, "email" => null, "birthday" => null, "avatar" => $data->profile_image_url_https);
 }
开发者ID:jgianpiere,项目名称:ZanPHP,代码行数:10,代码来源:twitter.php

示例12: editOrSave

 private function editOrSave()
 {
     $validations = array("exists" => array("Slug" => slug(POST("title", "clean")), "Language" => POST("language")), "title" => "required", "content" => "required");
     $data = array("ID_User" => SESSION("ZanUserID"), "Slug" => slug(POST("title", "clean")), "Content" => POST("content", "clean"), "Start_Date" => now(4), "Text_Date" => now(2));
     $this->data = $this->Data->proccess($data, $validations);
     if (isset($this->data["error"])) {
         return $this->data["error"];
     }
     return FALSE;
 }
开发者ID:no2key,项目名称:MuuCMS,代码行数:10,代码来源:pages.php

示例13: checkLoad

 /**
  * [登录信息检测]
  * @param  [array] $post [用户名,密码]
  * @return [boolen]      [description]
  */
 public function checkLoad($post)
 {
     $uid = $this->where('user="' . $post['user'] . '" and pwd="' . md5($post['pwd']) . '"')->getField('uid');
     if ($uid) {
         SESSION('uid', $uid);
         SESSION('user', $post[user]);
         $res = true;
     } else {
         $res = false;
     }
     return $res;
 }
开发者ID:a349944418,项目名称:test,代码行数:17,代码来源:UserModel.class.php

示例14: apply_settings

function apply_settings($password, $password2, $realname)
{
    global $LSP_URL;
    if ($password != $password2) {
        display_error('Password mismatch');
        return false;
    } else {
        change_user(SESSION(), $realname, $password);
        display_success('Account settings have been updated', array('<a href="">User Settings</a>', 'Success'), $LSP_URL . "?account=settings");
        return true;
    }
}
开发者ID:kmklr72,项目名称:lmms.io,代码行数:12,代码来源:user_settings.php

示例15: getFacebookUser

 function getFacebookUser($code)
 {
     $response = file_get_contents("https://graph.facebook.com/oauth/access_token?client_id=" . FB_APP_ID . "&redirect_uri=" . encode(FB_APP_URL, true) . "&client_secret=" . FB_APP_SECRET . "&code=" . $code);
     $params = null;
     parse_str($response, $params);
     if (isset($params["access_token"])) {
         SESSION("ZanUserServiceAccessToken", $params["access_token"]);
         $graphURL = "https://graph.facebook.com/me?fields=" . FB_APP_FIELDS . "&access_token=" . $params["access_token"];
         $user = json_decode(file_get_contents($graphURL));
         return array("serviceID" => $user->id, "username" => $user->username, "name" => $user->name, "email" => $user->email, "birthday" => $user->birthday, "avatar" => $user->picture->data->url);
     }
     return false;
 }
开发者ID:jgianpiere,项目名称:ZanPHP,代码行数:13,代码来源:facebook.php


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