本文整理汇总了PHP中Session::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::delete方法的具体用法?PHP Session::delete怎么用?PHP Session::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: country
/**
* Change country
*
* @param string $country
*/
public function country($country)
{
if (in_array($country, Kohana::config('site.countries'))) {
if ($this->session->get('country') == $country) {
// Clear country if same as given
$this->session->delete('country');
} else {
// Set country
$this->session->set('country', $country);
}
}
url::back();
}
示例2: logout
public function logout()
{
// remove data from database
$this->_db->delete('users_session', array('user_id', '=', $this->data()->id));
Session::delete($this->_sessionName);
Cookie::delete($this->_cookieName);
}
示例3: session_destroy
/**
* Destroys the session, removing all data stored in this session and
* removing any reference to this session.
*/
public function session_destroy()
{
# Remove cookie
remove_cookie($this->sign($this->session->id, $this->session->salt));
# Remove session from database
$this->session->delete();
}
示例4: action_profile
public function action_profile()
{
$data = null;
$data['user'] = Model_User::query()->related('user_providers')->where('id', static::$user_id)->get_one();
$data['api_key'] = Auth::get('api_key');
if (Input::Method() == 'POST') {
$new_password = Input::Post('new_password');
$current_password = Input::Post('current_password');
if (empty($new_password) === false) {
if (empty($current_password) === true) {
Session::set('error', 'You must enter your old password in first!');
$this->template->content = View::Forge('settings/profile', $data);
return;
} else {
if (Auth::change_password($current_password, $new_password) === false) {
Session::set('error', 'Wrong Password');
$this->template->content = View::Forge('settings/profile', $data);
return;
} else {
Session::delete('current_password');
}
}
}
// update the data for the current user
try {
Auth::update_user(array('email' => Input::Post('email'), 'fullname' => Input::Post('full_name')));
} catch (Exception $e) {
Session::set('error', $e->getMessage());
$this->template->content = View::Forge('settings/profile', $data);
return;
}
Session::set('success', 'Your profile has been updated');
}
$this->template->content = View::Forge('settings/profile', $data);
}
示例5: __construct
function __construct()
{
if (isset($_COOKIE)) {
Session::delete();
}
header('Location: /');
}
示例6: action_index
public function action_index()
{
// clear redirect referrer
\Session::delete('submitted_redirect');
// load language
\Lang::load('index');
// read flash message for display errors.
$form_status = \Session::get_flash('form_status');
if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
$output['form_status'] = $form_status['form_status'];
$output['form_status_message'] = $form_status['form_status_message'];
}
unset($form_status);
// get total accounts
$output['total_accounts'] = \Model_Accounts::count();
// <head> output ----------------------------------------------------------------------------------------------
$output['page_title'] = $this->generateTitle(\Lang::get('admin_administrator_dashbord'));
// <head> output ----------------------------------------------------------------------------------------------
// breadcrumb -------------------------------------------------------------------------------------------------
$page_breadcrumb = [];
$page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
$output['page_breadcrumb'] = $page_breadcrumb;
unset($page_breadcrumb);
// breadcrumb -------------------------------------------------------------------------------------------------
// the admin views or theme should follow this structure. (admin/templates/controller/method) and follow with _v in the end.
return $this->generatePage('admin/templates/index/index_v', $output, false);
}
示例7: action_list
public function action_list()
{
$view = View::forge('admin/list');
if (Session::get('status')) {
$view->set_global('status', Session::get('status'));
Session::delete('status');
}
if (\Input::post()) {
if (Auth::delete_user(\Input::param('username'))) {
Session::set('status', array('css' => 'success', 'msg' => 'ユーザ削除に成功しました'));
Response::redirect('admin/list');
} else {
Session::set('status', array('css' => 'danger', 'msg' => 'ユーザ削除に失敗しました'));
Response::redirect('admin/list');
}
}
$list = DB::select('id', 'username', 'email', 'group')->from('users')->where('group', '!=', 100);
$total = $list->execute()->count();
$config = array('per_page' => 20, 'num_links' => 10, 'show_first' => true, 'show_last' => true, 'total_items' => $total, 'uri_segment' => 3);
$pagination = Pagination::forge('mypagination', $config);
$list->limit($pagination->per_page)->offset($pagination->offset);
$result = $list->execute()->as_array();
$view->set_global('list', $result);
$view->set_global('pagination', $pagination);
return $view;
}
示例8: logout
/**
* Log out a user by removing the related session variables.
*
* @param boolean $destroy completely destroy the session
* @return boolean
*/
public function logout($destroy = false)
{
// Delete the autologin cookie to prevent re-login
if (cookie::get($this->config['cookie_name'])) {
cookie::delete($this->config['cookie_name']);
}
// Logout 3rd party?
if (FB::enabled() && Visitor::instance()->get_provider()) {
$this->session->delete($this->config['session_key'] . '_provider');
try {
FB::instance()->expire_session();
} catch (Exception $e) {
}
}
// Destroy the session completely?
if ($destroy === true) {
$this->session->destroy();
} else {
// Remove the user from the session
$this->session->delete($this->config['session_key']);
// Regenerate session_id
$this->session->regenerate();
}
// Double check
return !$this->logged_in();
}
示例9: deleteApplySeesion
public static function deleteApplySeesion()
{
Session::delete('admission.unit');
Session::delete('ssc.roll');
Session::delete('ssc.session');
Session::delete('ssc.res');
Session::delete('ssc.py');
Session::delete('ssc.board');
Session::delete('ssc.group');
Session::delete('ssc.gpa');
Session::delete('hsc.roll');
Session::delete('hsc.session');
Session::delete('hsc.res');
Session::delete('hsc.py');
Session::delete('hsc.board');
Session::delete('hsc.group');
Session::delete('hsc.gpa');
Session::delete('admission.name');
Session::delete('admission.father.name');
Session::delete('admission.mother.name');
Session::delete('admission.gender');
Session::delete('admission.nat');
Session::delete('admission.preadress');
Session::delete('admission.peradress');
Session::delete('admission.contact');
Session::delete('admission.dob');
Session::delete('admission.photo');
}
示例10: delete
function delete()
{
$translator = new Translator();
$user = new User();
try {
$id = array_shift($this->param);
$user->disable($_SESSION['user_id']);
Session::delete();
echo <<<EOF
<div class="container">
<div class="page-header">
<h1>{$translator->User_updated}</h1>
</div>
<p class="lead">{$translator->User_updated_Desc}</p>
<p >{$translator->Error_Backprofile}</p>
</div>
<script type="text/javascript">
window.location.href='/';
</script>
EOF;
} catch (Exception $e) {
echo <<<EOF
<div class="container">
<div class="page-header">
<h1>{$translator->User_error}</h1>
</div>
<p class="lead">{$translator->User_error_Desc}</p>
<p >{$translator->Error_Backusers}</p>
</div>
EOF;
}
}
示例11: logout
/**
* Logout
*/
public function logout($params)
{
Cookie::delete('login');
Session::delete('username');
header('Location: ' . $params['redirect']);
exit;
}
示例12: callLoginAction
private function callLoginAction($module = 'default')
{
Session::delete('user');
require_once MODULE_PATH . $module . DS . 'controllers' . DS . 'LoginController.php';
$indexController = new LoginController($this->_params);
$indexController->indexAction();
}
示例13: cerrar
function cerrar()
{
Auth::destroy_identity();
Session::delete("usuario_id");
Session::delete("usuario_nombrecompleto");
Router::redirect("login/index");
}
示例14: logout
public function logout()
{
if (!is_null(Session::get('person'))) {
Session::delete('person');
}
Router::redirect('/personal/');
}
示例15: clean
/**
* Método para limpiar los mensajes almacenados
*/
public static function clean()
{
//Reinicio la variable de los mensajes
self::$_contentMsj = array();
//Elimino los almacenados en sesión
Session::delete('mkc-messages');
}