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


PHP session::clear方法代碼示例

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


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

示例1: render

 /**
  * Function form render
  * @return html [Form bloc all fields]
  */
 public function render()
 {
     session::clear('f_v');
     session::set('f_v', session::generate_sid());
     $verif_value = session::get('f_v');
     $this->form_bloc .= '<form novalidate="novalidate" method="post" class="form-horizontal" id="' . $this->_id_form . '" action="#">';
     $this->form_bloc .= '<input name="verif" type="hidden" value="' . $verif_value . '" />';
     $this->form_bloc .= '<fieldset>';
     $this->form_bloc .= $this->form_fields;
     $this->form_bloc .= '</fieldset>';
     $this->form_bloc .= $this->form_button;
     $this->form_bloc .= '</form>';
     $this->form_bloc .= $this->js_render();
     return print $this->form_bloc;
 }
開發者ID:rachidkada,項目名稱:MRN_PRO,代碼行數:19,代碼來源:form.class.php

示例2: form_verif

 /**
  * Function Format verif form get an set
  * using session 
  * return string true.
  */
 public static function form_verif($sens = true)
 {
     if ($sens == true) {
         session::clear('f_v');
         session::set('f_v', session::generate_sid());
         $str = session::get('f_v');
         echo $str;
     } else {
         if (Mreq::tp('verif') != null) {
             if (Mreq::tp('verif') == session::get('f_v')) {
                 return true;
             } else {
                 exit('3#Token non valid');
             }
             return true;
         }
     }
 }
開發者ID:ATS001,項目名稱:MRN,代碼行數:23,代碼來源:init.class.php

示例3: logOut

 /**
  * 登出
  */
 public function logOut()
 {
     $sessID = session_id();
     $sessLogin = session::get('login');
     if (isset($sessLogin['user_id'])) {
         $userModel = new M('user');
         $userModel->where(array('id' => $sessLogin['user_id']))->data(array('session_id' => ''))->update();
     }
     session::clear('login');
     self::$sessObj->destroy($sessID);
 }
開發者ID:weipinglee,項目名稱:nn2,代碼行數:14,代碼來源:checkRight.php

示例4: do_login

 public function do_login()
 {
     global $db;
     $this->id_user = $this->_data['user'];
     if ($this->error == true) {
         $this->get_user();
     }
     if ($this->error == true) {
         $this->check_active();
     }
     if ($this->error == true) {
         $this->check_ctc();
     }
     if ($this->error == true) {
         $this->check_pass();
     }
     if ($this->error == true) {
         $this->check_signature();
     }
     //All test is ok do LOGIN
     if ($this->error == true) {
         //Update CTC to 0
         if (!$db->UpdateSinglRows('users_sys', 'ctc', 0, $this->user_info['id'])) {
             $this->log .= $db->Error();
             $this->error = false;
             $this->log .= '</br>Problème MAJ CTC';
         }
         //Expire opened Session for this user
         $val_session['expir'] = 'CURRENT_TIMESTAMP';
         $whr_session['user'] = $this->id_user;
         if (!$db->UpdateRows('session', $val_session, $whr_session)) {
             $this->log .= $db->Error();
             $this->error = false;
             $this->log .= '</br>Problème fermeture sessions ouvertes';
         }
         //Insert new session into DB
         $this->token = md5(uniqid(rand(), true));
         $val_new_session['id'] = MySQL::SQLValue($this->token);
         $val_new_session['user'] = MySQL::SQLValue($this->user_info['nom']);
         $val_new_session['userid'] = MySQL::SQLValue($this->user_info['id']);
         $val_new_session['ip'] = MySQL::SQLValue($_SERVER['REMOTE_ADDR']);
         $val_new_session['browser'] = MySQL::SQLValue($_SERVER['HTTP_USER_AGENT']);
         if (!$db->InsertRow('session', $val_new_session)) {
             $this->log .= $db->Error();
             $this->error = false;
             $this->log .= '</br>Problème enregistrement nouvelle session';
         }
         //Update lastactive into users_sys
         $val_time['lastactive'] = 'CURRENT_TIMESTAMP';
         $whr_user['id'] = MySQL::SQLValue($this->user_info['id']);
         if (!$db->UpdateRows('users_sys', $val_time, $whr_user)) {
             $this->log .= $db->Error();
             $this->error = false;
             $this->log .= '</br>Problème MAJ dérnièrre activité';
         }
         //Open new session for this Login
         if ($this->error == true) {
             //Stop Exsiting Captcha session and creat Sys Sessions
             $session = new session();
             $session->clear('Captcha');
             //Clear Captcha Session
             $session->set('username', $this->user_info['nom']);
             $session->set('userid', $this->user_info['id']);
             $session->set('time', time());
             $session->set('ssid', $this->token);
             $session->set('agence', $this->user_info['agence']);
             $session->set('service', $this->user_info['service']);
             $session->set('imda', $this->user_info['signature']);
             $session->set('defapp', $this->user_info['defapp']);
             $session->set('key', $this->user_info['pass']);
         }
         $this->log .= '<br>Bienvenue <strong>' . $this->user_info['lnom'] . ' ' . $this->user_info['fnom'] . '</strong></br> Vous serez rédiriger dans qulques instants';
     }
     //check if last error is true then return true else rturn false.
     if ($this->error == false) {
         return false;
     } else {
         return true;
     }
 }
開發者ID:ATS001,項目名稱:MRN,代碼行數:80,代碼來源:login_m.php

示例5: check

 /**
  * 驗證驗證碼
  * @param string $text 用戶輸入的驗證碼
  * @return bool 正確與否
  */
 public function check($text)
 {
     $res = $text != '' && $text == session::get($this->sessName);
     session::clear($this->sessName);
     return $res;
 }
開發者ID:weipinglee,項目名稱:nn2,代碼行數:11,代碼來源:captcha.php


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