Browse Source

logout user: commit destroyed session

Andrew Dolgov 6 months ago
parent
commit
ec5687a62b
1 changed files with 3 additions and 3 deletions
  1. 3 3
      include/functions.php

+ 3 - 3
include/functions.php

@@ -811,10 +811,11 @@
 	}
 
 	function logout_user() {
-		session_destroy();
+		@session_destroy();
 		if (isset($_COOKIE[session_name()])) {
 		   setcookie(session_name(), '', time()-42000, '/');
 		}
+		session_commit();
 	}
 
 	function validate_csrf($csrf_token) {
@@ -856,8 +857,7 @@
 				}
 
 				if (!$_SESSION["uid"]) {
-					@session_destroy();
-					setcookie(session_name(), '', time()-42000, '/');
+					logout_user();
 
 					render_login_form();
 					exit;