]> git.mxchange.org Git - friendica.git/commitdiff
"remember me" in session does work now
authorMichael Vogel <icarus@dabo.de>
Tue, 5 Apr 2016 21:28:33 +0000 (23:28 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 1 May 2016 11:47:24 +0000 (13:47 +0200)
include/auth.php
include/session.php

index a5b6432fff37c35cc31070eb7ae585129accfae1..4abff1971008ec77f20d83f80cd59e6cc4442f45 100644 (file)
@@ -5,35 +5,14 @@ require_once('include/security.php');
 require_once('include/datetime.php');
 
 function nuke_session() {
-       if (get_config('system', 'disable_database_session')) {
-               session_unset();
-               return;
-       }
 
        new_cookie(0); // make sure cookie is deleted on browser close, as a security measure
-
-       unset($_SESSION['authenticated']);
-       unset($_SESSION['uid']);
-       unset($_SESSION['visitor_id']);
-       unset($_SESSION['administrator']);
-       unset($_SESSION['cid']);
-       unset($_SESSION['theme']);
-       unset($_SESSION['mobile-theme']);
-       unset($_SESSION['page_flags']);
-       unset($_SESSION['submanage']);
-       unset($_SESSION['my_url']);
-       unset($_SESSION['my_address']);
-       unset($_SESSION['addr']);
-       unset($_SESSION['return_url']);
-
+       session_unset();
 }
 
 
 // login/logout
 
-
-
-
 if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-params'))) || ($_POST['auth-params'] !== 'login'))) {
 
        if(((x($_POST,'auth-params')) && ($_POST['auth-params'] === 'logout')) || ($a->module === 'logout')) {
@@ -41,6 +20,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
                // process logout request
                call_hooks("logging_out");
                nuke_session();
+               new_cookie(-1);
                info( t('Logged out.') . EOL);
                goaway(z_root());
        }
@@ -90,8 +70,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
                }
                authenticate_success($r[0], false, false, $login_refresh);
        }
-}
-else {
+} else {
 
        if(isset($_SESSION)) {
                nuke_session();
@@ -209,13 +188,11 @@ else {
 }
 
 function new_cookie($time) {
-       if (!get_config('system', 'disable_database_session'))
-               $old_sid = session_id();
 
-       session_set_cookie_params($time);
+       if ($time != 0)
+               $time = $time + time();
 
-       if (!get_config('system', 'disable_database_session')) {
-               session_regenerate_id(false);
-               q("UPDATE session SET sid = '%s' WHERE sid = '%s'", dbesc(session_id()), dbesc($old_sid));
-       }
+       $params = session_get_cookie_params();
+       setcookie(session_name(), session_id(), $time, $params['path'], $params['domain'], $params['secure'], isset($params['httponly']));
+       return;
 }
index 12551efc42f8d595aae47186596822bdd0c598f8..8f9d64606c00b3dda205e4e85badcca6316f8571 100644 (file)
@@ -69,7 +69,6 @@ function ref_session_destroy ($id) {
 if(! function_exists('ref_session_gc')) {
 function ref_session_gc($expire) {
        q("DELETE FROM `session` WHERE `expire` < %d", dbesc(time()));
-       //q("OPTIMIZE TABLE `sess_data`");
        return true;
 }}