user-management-bootstrap/logout.php

19 lines
648 B
PHP
Raw Permalink Normal View History

2016-04-20 15:07:12 +02:00
<?php
2016-07-08 00:39:33 +02:00
ini_set('log_errors', 1);
error_log('Hello, errors logout!');
2016-04-20 15:07:12 +02:00
include 'db_connect.php';
include 'functions.php';
sec_session_start();
// Elimina tutti i valori della sessione.
$username = $_SESSION['username'];
$pdo->query("UPDATE `members` SET `loggedin` = '0' where `members`.`username` = '$username'");
2016-07-08 00:39:33 +02:00
$_SESSION = [];
2016-04-20 15:07:12 +02:00
// Recupera i parametri di sessione.
$params = session_get_cookie_params();
// Cancella i cookie attuali.
2016-07-08 00:39:33 +02:00
setcookie(session_name(), '', time() - 42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
2016-04-20 15:07:12 +02:00
// Cancella la sessione.
session_destroy();
header('Location: https://autocontrollo.ch');