From 02d4ab1a60eb48f00ad60ec48d02b65509a27e56 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 9 May 2015 18:30:28 +0200 Subject: fix sessions lasting through reinstallations, they are now deleted --- install/index.php | 20 ++++++++++++++++++++ install/install_functions.php | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/install/index.php b/install/index.php index 77e50864..81fd407a 100755 --- a/install/index.php +++ b/install/index.php @@ -16,6 +16,26 @@ $email = ""; require_once('install_functions.php'); +// Start by destroying session to avoid wrong logins from previous installations +// cookie part +$cookiedir = ''; +if (dirname($_SERVER['SCRIPT_NAME'])!='/') { + $cookiedir = dirname($_SERVER["SCRIPT_NAME"]).'/'; +} + +if (isset($_SERVER['HTTP_COOKIE'])) { + $cookies = explode(';', $_SERVER['HTTP_COOKIE']); + foreach($cookies as $cookie) { + $parts = explode('=', $cookie); + $name = trim($parts[0]); + setcookie($name, '', time()-1000); + setcookie($name, '', time()-1000, $cookiedir); + } +} +// session part +session_destroy(); + + if (isset($_GET['clean'])) { if (is_dir('install')){ delTree('install', true); diff --git a/install/install_functions.php b/install/install_functions.php index a40db373..a3bf3661 100644 --- a/install/install_functions.php +++ b/install/install_functions.php @@ -110,4 +110,4 @@ function executeQuery($handle, $sql, $params) { } } -?> \ No newline at end of file +?> -- cgit v1.2.3