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


PHP Sessions类代码示例

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


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

示例1: ExitApplication

 function ExitApplication($token)
 {
     if (!empty($token)) {
         $session = new Sessions();
         $session->ClearSession($token);
     }
     return;
 }
开发者ID:brahimmachkouri,项目名称:phpDHCPAdmin,代码行数:8,代码来源:class.cleanup.php

示例2: isAdminSess

 function isAdminSess()
 {
     $sessId = session_id();
     $session = new Sessions();
     $dbSessId = $session->sessionValid($sessId);
     $myUser = null;
     if (($dbData = $session->dataField($sessId)) != null) {
         $myUser = $session->isAdmin($dbData);
     }
     if (!isset($dbSessId) || !isset($sessId) || !isset($myUser) || $sessId != $dbSessId) {
         print "forwarded to the logout.php <br>";
         header("Location: logout.php");
     }
 }
开发者ID:nateirwin,项目名称:custom-historic,代码行数:14,代码来源:StoreSession.php

示例3: checkCRF

 /**
  * Check token submitted
  * @param $token
  * @return bool
  */
 public static function checkCRF($token)
 {
     if (!$token) {
         return false;
     }
     return Sessions::get('current_token') != trim($token) ? false : true;
 }
开发者ID:rivomanana,项目名称:rv-slim-base,代码行数:12,代码来源:Token.php

示例4: getHandler

 public static function getHandler()
 {
     if (self::$handler === false) {
         self::$handler = new Sessions();
     }
     return self::$handler;
 }
开发者ID:ekowabaka,项目名称:wyf,代码行数:7,代码来源:Sessions.php

示例5: authenticate

 public function authenticate()
 {
     $nick = strtolower($this->username);
     $user = Users::model()->find('LOWER(email)=?', array($nick));
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif (!$user->validatePassword($this->password, $user->salt)) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } elseif ($user->status == 0) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
         return 2;
     } elseif ($user->status == 4) {
         // user is banned
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
         return 3;
     } else {
         $this->_id = $user->id;
         $this->username = $user->email;
         $this->setState('isAdmin', $user->status == 3);
         $this->setState('permissions', $user->status);
         $this->setState('nick', $user->nick);
         $this->setState('session_key', md5($user->email . time() . uniqid() . $user->salt));
         $this->setState('user_ip', Yii::app()->request->userHostAddress);
         Sessions::model()->deleteAllByAttributes(array('user_id' => $user->id));
         $this->errorCode = self::ERROR_NONE;
     }
     return $this->errorCode == self::ERROR_NONE;
 }
开发者ID:mrtos,项目名称:OpenNVR,代码行数:28,代码来源:UserIdentity.php

示例6: Session

 public function Session($Name, $Value = null)
 {
     $SESSIONS = new Sessions();
     if ($Value) {
         $SESSIONS->{$Name} = $Value;
         $SESSIONS->Update();
     } else {
         $Value = $SESSIONS->Get($Name);
         if ($Value) {
             $SESSIONS->{$Name} = $Value;
             $SESSIONS->Update();
         }
     }
     unset($SESSIONS);
     return $Value;
 }
开发者ID:baiduXM,项目名称:agent,代码行数:16,代码来源:class.UsersModule.php

示例7: checkLoginState

 /**
  * 检查用户是否已经登录
  * @param unknown_type $username
  */
 public function checkLoginState($username)
 {
     $string = 's:' . strlen($username) . ':"' . $username . '"';
     $criteria = new CDbCriteria();
     $criteria->addSearchCondition('data', $string);
     $model = Sessions::model()->find($criteria);
     return $model;
 }
开发者ID:yunsite,项目名称:my-advertise,代码行数:12,代码来源:LoginForm.php

示例8: logout

 public function logout()
 {
     /*
      * compares session token against get method to see if it's the actual user
      */
     if (Sessions::get('token') == Requests::get('token')) {
         Sessions::destroy();
     }
 }
开发者ID:nc1991,项目名称:Basic-MVC,代码行数:9,代码来源:UserController.php

示例9: getOnlineUsers

 public static function getOnlineUsers()
 {
     $sessions = Sessions::model()->findAll();
     $temp = array();
     foreach ($sessions as $session) {
         $temp[] = $session->user;
     }
     return $temp;
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:9,代码来源:SessionChild.php

示例10: adminLoginNow

function adminLoginNow()
{
    $username = $_REQUEST['login_user'];
    $password = $_REQUEST['login_password'];
    $admin = new administrator();
    $admin->setUsername($username);
    $data = $admin->getAdminFromUsername();
    if (count($data) > 0) {
        $admin->extractor($data);
        if ($admin->password() == md5($password)) {
            $session = new Sessions();
            $session->setAdminLoginSessions($admin->id(), $admin->name(), $admin->email());
            Common::jsonSuccess("Success");
        } else {
            Common::jsonError("Login Error");
        }
    } else {
        Common::jsonError("Login Error");
    }
}
开发者ID:jcodesdotme,项目名称:pp,代码行数:20,代码来源:login-controller.php

示例11: updateMainCityImages

function updateMainCityImages()
{
    $maincity = new MainCity();
    $session = new Sessions();
    $maincity->setMainCityId($session->getLastMainCityId());
    $data = $maincity->getMainCityFromId();
    $maincity->extractor($data);
    $imgs = $maincity->mainCityImage();
    if ($imgs != "") {
        $imgs = $imgs . ',' . $_REQUEST['images'];
    } else {
        $imgs = $_REQUEST['images'];
    }
    $maincity->setMainCityImage($imgs);
    if ($maincity->updateMainCityImages()) {
        Common::jsonSuccess("Main City Update Successfully!");
    } else {
        Common::jsonError("Error");
    }
}
开发者ID:jcodesdotme,项目名称:pp,代码行数:20,代码来源:maincity-controller.php

示例12: __isAuthenticated

 function __isAuthenticated()
 {
     return true;
     if (array_key_exists('HTTP_AUTH_KEY', $_SERVER)) {
         $authKey = $_SERVER['HTTP_AUTH_KEY'];
     } elseif (array_key_exists('auth_key', $_GET)) {
         $authKey = $_GET['auth_key'];
     } else {
         throw new RestException(401, 'Authentication Required');
     }
     $sessions = new Sessions();
     $session = $sessions->verifySession($authKey);
     if (is_array($session)) {
         $sesInfo = $sessions->getSessionUser($authKey);
         self::$userId = $sesInfo['USR_UID'];
         self::$authKey = $authKey;
         return true;
     }
     throw new RestException(401, 'Wrong Credentials!');
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:20,代码来源:Auth.php

示例13: afterDelete

 public function afterDelete()
 {
     parent::afterDelete();
     $shared = Shared::model()->findAllByAttributes(array('cam_id' => $this->id));
     foreach ($shared as $s) {
         Notifications::model()->deleteAllByAttributes(array('shared_id' => $s->id, 'status' => 1));
         $s->delete();
     }
     Sessions::model()->deleteAllByAttributes(array('real_id' => $this->id));
     Sessions::model()->deleteAllByAttributes(array('real_id' => $this->id . '_low'));
     return true;
 }
开发者ID:mrtos,项目名称:OpenNVR,代码行数:12,代码来源:Cams.php

示例14: add

 public function add()
 {
     $name = $_POST["name"];
     $lastname = $_POST["lastname"];
     $email = $_POST["email"];
     $pass = $_POST["pass"];
     $conf = $_POST["conf"];
     if ($name == null or $lastname == null or $email == null or $pass == null or $conf == null) {
         header("location: Unirse.php?error=1");
     } else {
         if ($pass != $conf) {
             header("location: Unirse.php?error=2");
         } else {
             $sql = "select * from usuario where Email='" . $email . "'";
             $result = $this->cone->procedure($sql);
             if ($result) {
                 if (!$result->fetch_assoc()) {
                     $sql = "select (count(idUsuario)+1) as 'newId' from usuario";
                     $result = $this->cone->procedure($sql);
                     if ($result) {
                         if ($row = $result->fetch_assoc()) {
                             $sql = "insert into Usuario values (" . $row['newId'] . ",'" . $name . "','" . $lastname . "','" . $email . "','" . $pass . "',null)";
                             $rs = $this->cone->procedure($sql);
                             if ($rs) {
                                 $ses = new Sessions();
                                 $ses->init();
                                 $ses->set("user", $email);
                                 header("location: ../User/index.php");
                             } else {
                                 header("location: Unirse.php?error=3");
                             }
                         }
                     }
                 } else {
                     header("location: Unirse.php?error=4");
                 }
             }
         }
     }
 }
开发者ID:BryanPalacios,项目名称:AppMul_ProyectoF,代码行数:40,代码来源:AddUser.php

示例15: loginCheck

 public static function loginCheck()
 {
     global $db;
     if (Sessions::get("login")) {
         $username = Session::get("login")['username'];
         if ($username) {
             $kontrol = $db->query("SELECT username FROM username = '{$username}'")->rowCount();
             return $kontrol ? true : false;
         }
     } else {
         return false;
     }
 }
开发者ID:vahitserifsaglam1,项目名称:ozsa-src,代码行数:13,代码来源:Security.php


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