Tools, FAQ, Tutorials:
Closing a Session Properly in PHP
How To Close a Session Properly in PHP?
✍: FYIcenter.com
Let's say you site requires users to login. When a logged in user clicks the logout button, you need to close the session associated with this user properly in 3 steps:
Below is a good sample script:
<?php
session_start();
$_SESSION = array();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
session_destroy();
print("<html><pre>");
print("Thank you for visiting FYICenter.com.\n");
print(" <a href=login.php>Login Again.</a>\n");
print("</pre></html>\n");
?>
⇒ What Is session_register() in PHP
⇐ Determining If a Session Is New in PHP
2016-10-22, ∼2326🔥, 0💬
Popular Posts:
How to how to use matched string and groups in replacements with re.sub()? When calling the re.sub()...
How to login to the Developer Portal internally by you as the publisher? Normally, the Developer Por...
How to create the Hello-3.0.epub package? I have all required files to create Hello-3.0.epub. To cre...
How to add images to my EPUB books Images can be added into book content using the XHTML "img" eleme...
Where to find tutorials on Using Azure API Management Developer Portal? Here is a list of tutorials ...