Show sourcecode

The following files exists in this folder. Click to view.

Foogler_blog/src

CHTMLPage.php
FDestroySession.php

FDestroySession.php

26 lines ASCII Windows (CRLF)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
//
// Function DestroySession
//
// Destroys the current session.
//

// ---------------------------------------------------------------------------------------
//
// Destroy the current session (logout user), if it exists. Review the manual
// http://se.php.net/manual/en/function.session-destroy.php
//

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
    
setcookie(session_name(), ''time()-42000'/');
}

// Finally, destroy the session.
session_destroy(); 
?>