本文整理汇总了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;
}
示例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;
}
}
}
示例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);
}
示例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;
}
}
示例5: check
/**
* 验证验证码
* @param string $text 用户输入的验证码
* @return bool 正确与否
*/
public function check($text)
{
$res = $text != '' && $text == session::get($this->sessName);
session::clear($this->sessName);
return $res;
}