Want to delete a PHP Session?
March 15th, 2007 by
Quatrux
A lot of PHP novice programmers which don’t want to understand how the sessions work in the beginning, usually doesn’t delete a session the right way, so I wanted to post an example PHP script session_delete(); which deletes everything as needed.
PHP
-
function session_delete($sname = ‘Current User’) {
-
# Set Session Name to a Variable
-
/* Empty the Cookie from Session */
-
/* Remove the Cookie Value */
-
/* Remove all the Info from the Super Global */
-
/* Free all session variables */
-
/* Destroy all data registered to a session */
-
return FALSE;
-
} else {
-
return TRUE;
-
}
-
}
Posted in PHP | No Comments »