- setSession('admin_login', '');
- setSession('admin_md5' , '');
- setSession('admin_last' , '');
- setSession('admin_to' , '');
-
- // Destroy session and return status
- if ($destroy) {
- return session_destroy();
+ setAdminId(0);
+ setAdminMd5('');
+ setAdminLast(0);
+
+ // Set cache to FALSE
+ $GLOBALS['isAdmin'] = FALSE;
+
+ // Destroy session if requested and return status
+ if ($destroy === TRUE) {
+ return destroySession();
+ } // END - if
+
+ // All fine if the session shall not really be destroyed
+ return TRUE;
+}
+
+// Destroys session and resets some "caches"
+function destroySession () {
+ // Unset "cache"
+ unset($GLOBALS['isSessionValid']);
+
+ // Destroy session
+ return session_destroy();
+}
+
+// Checks whether the session is valid
+function isSessionValid () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Then determine it
+ $GLOBALS[__FUNCTION__] = ((isset($GLOBALS['valid_session'])) && ($GLOBALS['valid_session'] === TRUE) && (isset($_COOKIE[session_name()])));