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


PHP session::has方法代码示例

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


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

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->session->has('lastActivityTime')) {
         $this->session->put('lastActivityTime', time());
     } else {
         if (time() - $this->session->get('lastActivityTime') > $this->getTimeOut()) {
             $this->session->forget('lastActivityTime');
             Auth::logout();
             return redirect($this->getRedirectUrl())->with([$this->getSessionLabel() => 'You have been inactive for ' . $this->timeout / 60 . ' minutes ago.']);
         }
     }
     $this->session->put('lastActivityTime', time());
     return $next($request);
 }
开发者ID:pnagaraju25,项目名称:laravel-sessiontimeout,代码行数:21,代码来源:SessionTimeout.php

示例2: checkSession

 public static function checkSession()
 {
     $engine = EngineAPI::singleton();
     $localvars = localvars::getInstance();
     if (!session::has('username')) {
         header('Location:/login');
     }
     return true;
 }
开发者ID:ddavisgraphics,项目名称:ThesisFrameworkApp,代码行数:9,代码来源:user.php

示例3: __construct

 /**
  * @brief Constructor
  *
  * @param Mixed $stateid The state ID to access
  * @throw BaseException
  */
 function __construct($stateid = null)
 {
     if ($stateid == null) {
         $this->state = self::$pstate;
     } else {
         if (session::has('viewstate_' . $stateid)) {
             $this->state = session::get('viewstate_' . $stateid);
         } else {
             throw new BaseException("No viewstate found with id");
         }
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:18,代码来源:viewstate.php

示例4: setupForm

 public function setupForm($id = null)
 {
     try {
         // call engine
         $engine = EngineAPI::singleton();
         $localvars = localvars::getInstance();
         $validate = new validate();
         // create customer form
         $form = formBuilder::createForm('TimeTracker');
         $form->linkToDatabase(array('table' => 'timeTracking'));
         if (!is_empty($_POST) || session::has('POST')) {
             $processor = formBuilder::createProcessor();
             $processor->processPost();
         }
         // form titles
         $form->insertTitle = "";
         $form->editTitle = "";
         $form->updateTitle = "";
         // if no valid id throw an exception
         if (!$validate->integer($id) && !isnull($id)) {
             throw new Exception(__METHOD__ . '() - Not a valid integer, please check the integer and try again.');
         }
         // form information
         $form->addField(array('name' => 'timeID', 'type' => 'hidden', 'value' => $id, 'primary' => TRUE, 'fieldClass' => 'id', 'showIn' => array(formBuilder::TYPE_INSERT, formBuilder::TYPE_UPDATE)));
         $form->addField(array('name' => 'projectIdLink', 'type' => 'hidden', 'label' => 'Project ID:', 'required' => TRUE, 'fieldClass' => 'projectID'));
         $form->addField(array('name' => 'customerIdLink', 'type' => 'hidden', 'label' => 'Customer ID:', 'fieldClass' => 'customerID', 'required' => TRUE));
         $form->addField(array('name' => 'startTime', 'type' => 'hidden', 'label' => 'start time:', 'fieldClass' => 'startTime', 'required' => TRUE));
         $form->addField(array('name' => 'endTime', 'type' => 'hidden', 'label' => 'end time:', 'fieldClass' => 'endTime', 'required' => TRUE));
         $form->addField(array('name' => 'totalHours', 'type' => 'hidden', 'label' => 'total time:', 'required' => TRUE, 'fieldClass' => 'totalHours'));
         $form->addField(array('name' => "completed", 'label' => "Has this project been completed?", 'showInEditStrip' => TRUE, 'type' => 'boolean', 'duplicates' => TRUE, 'options' => array("YES", "N0")));
         $form->addField(array('name' => "descriptionOfWork", 'label' => "Enter a description of the project:", 'type' => 'textarea'));
         // buttons and submissions
         $form->addField(array('showIn' => array(formBuilder::TYPE_UPDATE), 'name' => 'update', 'type' => 'submit', 'fieldClass' => 'submit', 'value' => 'Update'));
         $form->addField(array('showIn' => array(formBuilder::TYPE_UPDATE), 'name' => 'delete', 'type' => 'delete', 'fieldClass' => 'delete hidden', 'value' => 'Delete'));
         $form->addField(array('showIn' => array(formBuilder::TYPE_INSERT), 'name' => 'insert', 'type' => 'submit', 'fieldClass' => 'submit', 'value' => 'Submit'));
         return '{form name="TimeTracker" display="form"}';
     } catch (Exception $e) {
         errorHandle::errorMsg($e->getMessage());
     }
 }
开发者ID:ddavisgraphics,项目名称:TimeTrackerDemoApp_EngineAPI,代码行数:40,代码来源:timeTracker.php

示例5: setupForm

 public function setupForm($id = null)
 {
     try {
         // call engine
         $engine = EngineAPI::singleton();
         $localvars = localvars::getInstance();
         $validate = new validate();
         // create customer form
         $form = formBuilder::createForm('Projects');
         $form->linkToDatabase(array('table' => 'projects'));
         if (!is_empty($_POST) || session::has('POST')) {
             $processor = formBuilder::createProcessor();
             $processor->processPost();
         }
         // form titles
         $form->insertTitle = "Add Project";
         $form->editTitle = "Edit Project";
         $form->updateTitle = "Edit Project";
         // if no valid id throw an exception
         if (!$validate->integer($id) && !isnull($id)) {
             throw new Exception(__METHOD__ . '() - Not a valid integer, please check the integer and try again.');
         }
         // form information
         $form->addField(array('name' => 'projectID', 'type' => 'hidden', 'value' => $id, 'primary' => TRUE, 'fieldClass' => 'id', 'showIn' => array(formBuilder::TYPE_INSERT, formBuilder::TYPE_UPDATE)));
         $form->addField(array('name' => 'customerID', 'label' => 'What customer owns this project?', 'type' => 'select', 'blankOption' => 'Select a Customer', 'linkedTo' => array('foreignTable' => 'customers', 'foreignField' => 'id', 'foreignLabel' => 'companyName')));
         $form->addField(array('name' => 'projectName', 'label' => 'Project Name:', 'required' => TRUE));
         $form->addField(array('name' => 'scope', 'label' => 'A simple statement of the scope of work being done:', 'required' => TRUE));
         $form->addField(array('name' => 'type', 'label' => 'Project Type:', 'required' => TRUE, 'type' => 'select', 'options' => array('design' => 'Design', 'development' => 'Programming or Development', 'consult' => 'Meeting or Consultation', 'other' => 'other')));
         $form->addField(array('name' => "completed", 'label' => "Has this project been completed?", 'showInEditStrip' => TRUE, 'type' => 'boolean', 'duplicates' => TRUE, 'options' => array("YES", "N0")));
         $form->addField(array('name' => "description", 'label' => "Enter a description of the project:", 'type' => 'textarea'));
         // buttons and submissions
         $form->addField(array('showIn' => array(formBuilder::TYPE_UPDATE), 'name' => 'update', 'type' => 'submit', 'fieldClass' => 'submit', 'value' => 'Update'));
         $form->addField(array('showIn' => array(formBuilder::TYPE_UPDATE), 'name' => 'delete', 'type' => 'delete', 'fieldClass' => 'delete hidden', 'value' => 'Delete'));
         $form->addField(array('showIn' => array(formBuilder::TYPE_INSERT), 'name' => 'insert', 'type' => 'submit', 'fieldClass' => 'submit', 'value' => 'Submit'));
         return '{form name="Projects" display="form"}';
     } catch (Exception $e) {
         errorHandle::errorMsg($e->getMessage());
     }
 }
开发者ID:ddavisgraphics,项目名称:TimeTrackerDemoApp_EngineAPI,代码行数:39,代码来源:projects.php

示例6: setupForm

 public function setupForm($id = null)
 {
     try {
         // call engine
         $engine = EngineAPI::singleton();
         $localvars = localvars::getInstance();
         $validate = new validate();
         // create customer form
         $form = formBuilder::createForm('Customers');
         $form->linkToDatabase(array('table' => 'customers'));
         if (!is_empty($_POST) || session::has('POST')) {
             $processor = formBuilder::createProcessor();
             $processor->processPost();
         }
         // form titles
         $form->insertTitle = "Add Customer";
         $form->editTitle = "Edit Customer";
         $form->updateTitle = "Edit Customer";
         // if no valid id throw an exception
         if (!$validate->integer($id) && !isnull($id)) {
             throw new Exception(__METHOD__ . '() - Not a valid integer, please check the integer and try again.');
         }
         // form information
         $form->addField(array('name' => 'ID', 'type' => 'hidden', 'value' => $id, 'primary' => TRUE, 'fieldClass' => 'id', 'showIn' => array(formBuilder::TYPE_INSERT, formBuilder::TYPE_UPDATE)));
         $form->addField(array('name' => 'firstName', 'label' => 'First Name:', 'required' => TRUE));
         $form->addField(array('name' => 'lastName', 'label' => 'Last Name:', 'required' => TRUE));
         $form->addField(array('name' => 'companyName', 'label' => 'Company Name:', 'required' => TRUE));
         $form->addField(array('name' => 'email', 'label' => 'Customer Email:', 'required' => TRUE));
         $form->addField(array('name' => 'phone', 'label' => 'Customer Phone Number:', 'required' => TRUE));
         $form->addField(array('name' => "website", 'label' => "Customers Website:", 'type' => 'URL'));
         // buttons and submissions
         $form->addField(array('showIn' => array(formBuilder::TYPE_UPDATE), 'name' => 'update', 'type' => 'submit', 'fieldClass' => 'submit', 'value' => 'Update'));
         $form->addField(array('showIn' => array(formBuilder::TYPE_UPDATE), 'name' => 'delete', 'type' => 'delete', 'fieldClass' => 'delete hidden', 'value' => 'Delete'));
         $form->addField(array('showIn' => array(formBuilder::TYPE_INSERT), 'name' => 'insert', 'type' => 'submit', 'fieldClass' => 'submit', 'value' => 'Submit'));
         return '{form name="Customers" display="form"}';
     } catch (Exception $e) {
         errorHandle::errorMsg($e->getMessage());
     }
 }
开发者ID:ddavisgraphics,项目名称:TimeTrackerDemoApp_EngineAPI,代码行数:39,代码来源:customers.php

示例7: dbSanitize

$localvars = localvars::getInstance();
// username
$username = dbSanitize(session::get('username'));
// rating sys
$starHTML = '<div class="rating-system">
                    <span class="star" data-star="1"></span>
                    <span class="star" data-star="2"></span>
                    <span class="star" data-star="3"></span>
                    <span class="star" data-star="4"></span>
                    <span class="star" data-star="5"></span>
                  </div>';
// create customer form
$form = formBuilder::createForm('setup');
$form->linkToDatabase(array('table' => 'setupSurvey'));
if (!is_empty($_POST) || session::has('POST')) {
    $processor = formBuilder::createProcessor();
    $processor->setCallback('beforeInsert', 'feedbackCheck');
    $processor->processPost();
}
// form titles
$form->insertTitle = "Setup Survey";
$form->editTitle = "";
$form->updateTitle = "";
$form->template = "learningAppTemp";
// form information
$form->addField(array('name' => 'ssID', 'type' => 'hidden', 'primary' => TRUE, 'fieldClass' => 'id', 'showIn' => array(formBuilder::TYPE_INSERT, formBuilder::TYPE_UPDATE)));
$form->addField(array('name' => 'ipAddr', 'type' => 'hidden', 'fieldClass' => 'ip', 'value' => $_SERVER['REMOTE_ADDR'], 'showIn' => array(formBuilder::TYPE_INSERT, formBuilder::TYPE_UPDATE)));
$form->addField(array('name' => 'username', 'type' => 'hidden', 'label' => 'Username:', 'value' => $username, 'required' => TRUE, 'fieldClass' => 'username'));
$form->addField(array('name' => 'starRating', 'type' => 'plaintext', 'label' => 'How easy would you consider your choice, based on this lesson, would be to setup?', 'fieldClass' => 'starRating', 'value' => $starHTML));
$form->addField(array('name' => 'rating', 'type' => 'hidden', 'label' => '--', 'fieldClass' => 'rating'));
开发者ID:ddavisgraphics,项目名称:ThesisFrameworkApp,代码行数:30,代码来源:index.php

示例8:

<?php

$localvars = localvars::getInstance();
//do session checks
$sessionCheck = User::performChecks();
// set session tracker up
if (session::has('completePages')) {
    $thisPage = $localvars->get('pageName');
    $pages = session::get('completePages');
    $lesson = $thisPage . "Lesson";
    $survey = $thisPage . "LessonSurvey";
    if (in_array($lesson, $pages) && in_array($survey, $pages)) {
        $localvars->set('tracker', 'doNotTrack');
    } else {
        $localvars->set('tracker', 'track');
    }
} else {
    $localvars->set('tracker', 'track');
}
开发者ID:ddavisgraphics,项目名称:ThesisFrameworkApp,代码行数:19,代码来源:sessionChecks.php

示例9: function

use Illuminate\Support\Facades\Session;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    session::regenerate();
    session::put("name", "haitham");
    if (!session::has("name")) {
        return redirect('user/unauthenticated');
    }
    return view('login');
});
Route::get('/users', "testcontroller@allusers");
Route::get('/employee', function () {
    return view('employee');
});
Route::get('test', function () {
    $phpWord = new \PhpOffice\PhpWord\PhpWord();
    $section = $phpWord->createSection();
    $section->addText('Hello World!');
    $file = 'HelloWorld.docx';
    header("Content-Description: File Transfer");
    header('Content-Disposition: attachment; filename="' . $file . '"');
开发者ID:haithamsaadoon,项目名称:HaithamHR,代码行数:30,代码来源:routes.php

示例10: confirm

 public function confirm($confirmation_code)
 {
     if (!$confirmation_code) {
         Session::flash('alert-class', 'alert-warning');
         return Redirect::to('users/dashboard')->with('message', 'That confirmtion link is bad. Click on accounts to send another one')->with('alert-class', 'alert-danger')->withInput();
     }
     $user = User::whereConfirmationCode($confirmation_code)->first();
     if (!$user) {
         Session::flash('alert-class', 'alert-warning');
         return Redirect::to('users/dashboard')->with('message', 'That confirmtion link is bad. Click on accounts to send another one')->with('alert-class', 'alert-danger')->withInput();
     }
     $user->confirmed = 1;
     $user->confirmation_code = null;
     $user->save();
     //if there is a live order then redirect to that quote page
     if (session::has('order')) {
         return Redirect::to('quote/' . session::get('order') . '')->with('registerMessage', 'You are now verified and logged in.')->with('type', 'success');
     }
     //otherwise go to the dashboard
     return Redirect::to('users/dashboard')->with('message', 'You are now verified and logged in.')->with('alert-class', 'alert-success')->withInput();
 }
开发者ID:tommarshallandrews,项目名称:gloseventhire,代码行数:21,代码来源:UsersController.php

示例11: switch

<?php

if (session::has('username')) {
    $localvars = localvars::getInstance();
    $user = session::get('username');
    $localvars->set('user', $user);
    $completedModules = User::numCompleted(session::get('username'));
    switch ($completedModules) {
        case 0:
            $progress = "5%";
            break;
        case 1:
            $progress = "10%";
            break;
        case 2:
            $progress = "20%";
            break;
        case 3:
            $progress = "30%";
            break;
        case 4:
            $progress = "40%";
            break;
        case 5:
            $progress = "50%";
            break;
        case 6:
            $progress = "60%";
            break;
        case 7:
            $progress = "70%";
开发者ID:ddavisgraphics,项目名称:ThesisFrameworkApp,代码行数:31,代码来源:nav.php

示例12: updateFormInstance

 public static function updateFormInstance($token, array $data)
 {
     if (!session::has('fp')) {
         session::set('fp', array());
     }
     $fpdata = session::get('fp');
     $fpdata[$token] = $data;
     session::set('fp', $fpdata);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:9,代码来源:wizard.php

示例13: htmlspecialchars

<?php

require_once "../includes/engine.php";
templates::display('header');
if (isset($_POST['MYSQL']) && !session::has('username')) {
    $data = dbSanitize($_POST['MYSQL']);
    $username = $data['username'];
    $email = $data['email'];
    if (User::checkUser($username, $email) === true) {
        $options['timeout'] = strtotime('+2 years', time());
        session::set('username', $username, $options);
        header('Location:/welcomeback');
    } else {
        header('Location:/login?failed');
    }
}
if (isset($_GET['MYSQL']['failed'])) {
    $localvars->set('feedback', '<div class="error-message"> Login failed please check your password, or <a href="/"> register your account. </a> </div>');
}
?>
<section class="wrapper">
    <div class="container">
        <form class="registerUser" action="<?php 
print htmlspecialchars($_SERVER["PHP_SELF"]);
?>
" method="post">
            <div class="feedback">
                {local var="feedback"}
            </div>
            {csrf}
            <div class='username form-group'>
开发者ID:ddavisgraphics,项目名称:ThesisFrameworkApp,代码行数:31,代码来源:index.php


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