Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How To Close a Session Properly
How To Close a Session Properly? - PHP Script Tips - Understanding and Using Sessions
✍: 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"); ?>
2007-04-17, 4667👍, 0💬
Popular Posts:
When should the method invokeLater() be used? This method is used to ensure that Swing components ar...
How To Apply Filtering Criteria at Group Level? - MySQL FAQs - SQL SELECT Query Statements with GROU...
What is the significance of Finalize method in .NET? .NET Garbage collector does almost all clean up...
What is the difference between Class and structure’s ? Following are the key differences between the...
How can I show HTML examples without them being interpreted as part of my document? Within the HTML ...