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


PHP Session::isLoggedIn方法代码示例

本文整理汇总了PHP中Session::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::isLoggedIn方法的具体用法?PHP Session::isLoggedIn怎么用?PHP Session::isLoggedIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


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

示例1: confirm

 public function confirm($arguments)
 {
     if (Session::isLoggedIn()) {
         return Error::set(self::ERR_LOGGED_IN);
     }
     if (empty($arguments[0])) {
         return Error::set(self::ERR_NO_LOST_ID);
     }
     if (empty($arguments[1]) || $arguments[1] != 'auth' && $arguments[1] != 'password') {
         return Error::set(self::ERR_INIVALID_MODE);
     }
     $passReset = new passwordReset(ConnectionFactory::get('redis'));
     $info = $passReset->get($arguments[0], $arguments[1] == 'auth' ? true : false);
     if (is_string($info)) {
         return Error::set($info);
     }
     $users = new users(ConnectionFactory::get('mongo'));
     if ($arguments[1] == 'auth') {
         $users->changeAuth($info[1], true, false, false, false);
         $this->view['password'] = false;
     } else {
         $password = $users->resetPassword($info[1]);
         $this->view['password'] = $password;
     }
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:25,代码来源:lost.php

示例2: process

 public function process()
 {
     if (Session::isLoggedIn()) {
         Session::getUser()->setData('location', $this->getElementValue('location'));
     }
     setcookie('mylocation', $this->getElementValue('location'));
 }
开发者ID:jamesread,项目名称:lanlist.org,代码行数:7,代码来源:FormSetLocation.php

示例3: check

 public function check()
 {
     $this->setView('reclaim/index');
     if (Session::isLoggedIn()) {
         return Error::set('You\'re logged in!');
     }
     $this->view['valid'] = true;
     $this->view['publicKey'] = Config::get('recaptcha:publicKey');
     if (empty($_POST['recaptcha_challenge_field']) || empty($_POST['recaptcha_response_field'])) {
         return Error::set('We could not find the captcha validation fields!');
     }
     $recaptcha = Recaptcha::check($_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
     if (is_string($recaptcha)) {
         return Error::set(Recaptcha::$errors[$recaptcha]);
     }
     if (empty($_POST['username']) || empty($_POST['password'])) {
         return Error::set('All forms are required.');
     }
     $reclaims = new reclaims(ConnectionFactory::get('mongo'));
     $good = $reclaims->authenticate($_POST['username'], $_POST['password']);
     if (!$good) {
         return Error::set('Invalid username/password.');
     }
     $reclaims->import($_POST['username'], $_POST['password']);
     $users = new users(ConnectionFactory::get('mongo'));
     $users->authenticate($_POST['username'], $_POST['password']);
     header('Location: ' . Url::format('/'));
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:28,代码来源:reclaim.php

示例4: handler

 public static function handler($data = null)
 {
     if (isset($_SESSION['done_autoauth'])) {
         return;
     }
     if (empty($_SERVER['SSL_CLIENT_RAW_CERT'])) {
         return self::done();
     }
     if (Session::isLoggedIn()) {
         return self::done();
     }
     $certs = new certs(ConnectionFactory::get('mongo'), ConnectionFactory::get('redis'));
     $userId = $certs->check($_SERVER['SSL_CLIENT_RAW_CERT']);
     if ($userId == NULL) {
         return self::done();
     }
     $users = new users(ConnectionFactory::get('mongo'));
     $user = $users->get($userId, false);
     if (empty($user)) {
         return;
     }
     if (!in_array('autoauth', $user['auths'])) {
         return self::done();
     }
     if ($user['status'] == users::ACCT_LOCKED) {
         return self::done();
     }
     Session::setBatchVars($user);
     return self::done();
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:30,代码来源:autoauth.php

示例5: getPostDetailMenuItems

    public function getPostDetailMenuItems($post) {
        $menus = array();
        $map_template_path = Utils::getPluginViewDirectory('geoencoder').'geoencoder.map.tpl';

        //Define a menu item
        $map_menu_item = new MenuItem("Response Map", "", $map_template_path, 'Geoencoder');
        //Define a dataset to be displayed when that menu item is selected
        $map_menu_item_dataset_1 = new Dataset("geoencoder_map", 'PostDAO', "getRelatedPosts",
        array($post->post_id, $post->network, 'location') );
        //Associate dataset with menu item
        $map_menu_item->addDataset($map_menu_item_dataset_1);
        //Add menu item to menu
        $menus["geoencoder_map"] = $map_menu_item;

        $nearest_template_path = Utils::getPluginViewDirectory('geoencoder').'geoencoder.nearest.tpl';
        //Define a menu item
        $nearest_menu_item = new MenuItem("Nearest Responses", "", $nearest_template_path);
        //Define a dataset to be displayed when that menu item is selected
        $nearest_dataset = new Dataset("geoencoder_nearest", 'PostDAO', "getRelatedPosts",
        array($post->post_id, $post->network, !Session::isLoggedIn()));
        //Associate dataset with menu item
        $nearest_menu_item->addDataset($nearest_dataset);
        $nearest_dataset_2 = new Dataset("geoencoder_options", 'PluginOptionDAO', 'getOptionsHash',
        array('geoencoder', true));
        $nearest_menu_item->addDataset($nearest_dataset_2);
        //Add menu item to menu
        $menus["geoencoder_nearest"] = $nearest_menu_item;

        return $menus;
    }
开发者ID:rkabir,项目名称:ThinkUp,代码行数:30,代码来源:class.GeoEncoderPlugin.php

示例6: runRegisteredPluginsInsightGeneration

 /**
  * Runs the generateInsight function on all registered plugins.
  * @param Instance $instance
  * @param User $user User associated with the instance
  * @param arr last week of Post objects
  * @param int $number_days Number of days to backfill with insights
  * @throws UnauthorizedUserException
  * @return void
  */
 public function runRegisteredPluginsInsightGeneration(Instance $instance, User $user, $last_week_of_posts, $number_days)
 {
     if (!Session::isLoggedIn()) {
         throw new UnauthorizedUserException('You need a valid session to generate insights.');
     }
     $this->emitObjectFunction('generateInsight', array($instance, $user, $last_week_of_posts, $number_days));
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:16,代码来源:class.PluginRegistrarInsights.php

示例7: crawl

 /**
  * Gets called when crawler runs.
  *
  * About crawler exclusivity (mutex usage):
  * When launched by an admin, no other user, admin or not, will be able to launch a crawl until this one is done.
  * When launched by a non-admin, we first check that no admin run is under way, and if that's the case,
  * we launch a crawl for the current user only.
  * No user will be able to launch two crawls in parallel, but different non-admin users crawls can run in parallel.
  */
 public function crawl()
 {
     if (!Session::isLoggedIn()) {
         throw new UnauthorizedUserException('You need a valid session to launch the crawler.');
     }
     $mutex_dao = DAOFactory::getDAO('MutexDAO');
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     if (empty($owner)) {
         throw new UnauthorizedUserException('You need a valid session to launch the crawler.');
     }
     $global_mutex_name = 'crawler';
     // Everyone needs to check the global mutex
     $lock_successful = $mutex_dao->getMutex($global_mutex_name);
     if ($lock_successful) {
         // Global mutex was free, which means no admin crawls are under way
         if ($owner->is_admin) {
             // Nothing more needs to be done, since admins use the global mutex
             $mutex_name = $global_mutex_name;
         } else {
             // User is a non-admin; let's use a user mutex.
             $mutex_name = 'crawler-' . $owner->id;
             $lock_successful = $mutex_dao->getMutex($mutex_name);
             $mutex_dao->releaseMutex($global_mutex_name);
         }
     }
     if ($lock_successful) {
         $this->emitObjectMethod('crawl');
         $mutex_dao->releaseMutex($mutex_name);
     } else {
         throw new CrawlerLockedException("Error starting crawler; another crawl is already in progress.");
     }
 }
开发者ID:unruthless,项目名称:ThinkUp,代码行数:42,代码来源:class.Crawler.php

示例8: Page

	function Page($userstatus='dc') {
		if ( $userstatus == "registered" ) {
			if ( !(Session::isLoggedIn()) ) {
				echo 'Not logged in';
				exit;
			}
		}
	}
开发者ID:patricksjackson,项目名称:MyBin,代码行数:8,代码来源:class_page.php

示例9: hasDone

 /**
  * Determine if a user has finished a mission.
  * 
  * @param string $id Mission id.
  * 
  * @return bool True if the user has completed the mission before.
  */
 public static function hasDone($id)
 {
     if (!Session::isLoggedIn()) {
         return false;
     }
     $missions = self::getModel();
     return (bool) $missions->getTimesDone(Session::getVar('_id'), $id);
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:15,代码来源:mission.php

示例10: error

 /**
  * Write a new error message to log.
  * 
  * @param int $priority One of the PHP Syslog priority constants.
  * @param string $message Message to log.
  * 
  * @return bool True on success.
  */
 public static function error($priority, $message)
 {
     if (!self::$opened) {
         self::initiate();
     }
     $logHeader = (!Session::isLoggedIn() ? 'Guest' : 'User ' . Session::getVar('username')) . ' (' . microtime() . '):  ';
     return syslog($priority, $logHeader . $message);
 }
开发者ID:Bren2010,项目名称:BlueElephant,代码行数:16,代码来源:log.php

示例11: Session

 function __construct()
 {
     require_once 'Session.php';
     $S = new Session();
     if (!$S->isLoggedIn()) {
         throw new Exception("Admin access required", $this->class_id);
     }
 }
开发者ID:ashgkwd,项目名称:college-practs,代码行数:8,代码来源:Books.php

示例12: error

 /**
  * Write a new error message to log.
  * 
  * @param int $priority One of the PHP Syslog priority constants.
  * @param string $message Message to log.
  * 
  * @return bool True on success.
  */
 public static function error($message)
 {
     if (!self::$opened) {
         self::initiate();
     }
     $logHeader = (!Session::isLoggedIn() ? 'Guest' : 'User ' . Session::getVar('username')) . ' ' . $_SERVER['REMOTE_ADDR'] . ' (' . microtime(true) . '):  ';
     return self::$logModel->error($logHeader . $message);
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:16,代码来源:log.php

示例13: index

 public function index()
 {
     if (!Session::isLoggedIn()) {
         return Error::set('You need to log in!');
     }
     $this->view['valid'] = true;
     $missions = new missions(ConnectionFactory::get('mongo'));
     $this->view['missions'] = $missions->getTypes();
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:9,代码来源:missions.php

示例14: checkAuthentication

 public static function checkAuthentication()
 {
     if (!Session::isLoggedIn()) {
         // destroy session
         Session::destroy();
         // redirect to login screen
         header('Location: ' . URL_WITH_INDEX_FILE . 'login');
         exit;
     }
 }
开发者ID:puiu91,项目名称:Learning-MVC,代码行数:10,代码来源:Authenticate.php

示例15: __construct

 public function __construct()
 {
     parent::__construct('formChangePassword', 'Change password');
     if (!Session::isLoggedIn()) {
         throw new Exception('You need to be logged in to change your password.');
     }
     $this->addElement(Element::factory('password', 'password1', 'New password'));
     $this->addElement(Element::factory('password', 'password2', 'Password (confirm)'));
     $this->addButtons(Form::BTN_SUBMIT);
 }
开发者ID:jamesread,项目名称:lanlist.org,代码行数:10,代码来源:FormChangePassword.php


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