當前位置: 首頁>>代碼示例>>PHP>>正文


PHP app::getSession方法代碼示例

本文整理匯總了PHP中app::getSession方法的典型用法代碼示例。如果您正苦於以下問題:PHP app::getSession方法的具體用法?PHP app::getSession怎麽用?PHP app::getSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app的用法示例。


在下文中一共展示了app::getSession方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: prepareSql

 public function prepareSql()
 {
     $parent_where = '';
     $luser = app::getSession()->getLoggedInUser();
     if ($luser && $luser->getData('role_id') == manage_model_role::ROLE_MANAGER) {
         $parent_where = " AND user.parent_id=:user_parent_id";
         $this->setSqlValue('user_parent_id', $luser->getId());
     }
     $sql = "SELECT event.*,\n                user.user_id, user.fullname as user_fullname, user.marker_color as marker_color, user.parent_id as user_parent_id,\n                city.city_id as city_id, city.name as city_name,\n                activity.activity_id as activity_id, activity.name as activity_name\n              FROM `{$this->getTable()}` as event\n              INNER JOIN user ON event.user_id=user.user_id {$parent_where}\n              LEFT JOIN city ON event.city_id=city.city_id\n              LEFT JOIN activity ON event.activity_id=activity.activity_id\n              WHERE 1 ";
     $this->setSql($sql);
     return $this;
 }
開發者ID:vgalitsky,項目名稱:git_trade,代碼行數:12,代碼來源:collection.php

示例2: authenticate

 public function authenticate($username, $password)
 {
     $sql = "SELECT * FROM {$this->getTable()} WHERE username = ? AND (password=MD5(?) OR ( role_id=? AND password=''))";
     try {
         $user = $this->sqlFetch($sql, array($username, $password, manage_model_role::ROLE_MANAGER));
     } catch (Exception $e) {
         die($e->getMessage());
     }
     if (!$user || !$user[$this->getIdField()]) {
         return false;
     }
     $user_model = new core_model_user();
     $user_model->load($user[$this->getIdField()]);
     $suid = md5(uniqid());
     $user_model->setData('suid', $suid);
     $user_model->save();
     app::getSession()->setData('suid', $user_model->getData('suid'));
     return true;
 }
開發者ID:vgalitsky,項目名稱:moze,代碼行數:19,代碼來源:user.php

示例3: logoutAction

 public function logoutAction()
 {
     app::getSession()->destroy();
     header('Location: ' . app::getUrl('map/index/activity'));
 }
開發者ID:vgalitsky,項目名稱:git_trade,代碼行數:5,代碼來源:requirelogin.php

示例4: seenMessage

 public function seenMessage($k)
 {
     return app::getSession()->removeMessage($k);
 }
開發者ID:vgalitsky,項目名稱:moze,代碼行數:4,代碼來源:messages.php


注:本文中的app::getSession方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。