Error when logging out from admin

Help with installation and general calendar setttings

Error when logging out from admin

Postby Trevista » Fri Apr 25, 2014 4:16 pm

I have just updated an availability which shows correctly on published and admin calendar.
When I go to the logout button to log out i get:

Fatal error: Call to undefined function session_is_registered() in /path/user/public_html/Availability/ac-admin/admin-logout.php on line 9

I have removed the correct path details in italics for security of my web server!

Any ideas what this might be?
Trevista
 
Posts: 6
Joined: Wed Feb 23, 2011 11:37 pm

Re: Error when logging out from admin

Postby chris » Sat Apr 26, 2014 10:23 am

Hi,
This is due to changes in the PHP version that you have on your server. In later versions, this function has been depreciated.
I presume that you are not using the latest version of the calendar script as this error has been fixed.

To fix this error you need to open the ac-admin > admin-logout.php file and replace the whole contents which should look something like this:

Code: Select all
<?php
session_start();
function session_clear() {
// if session exists, unregister all variables that exist and destroy session
    $exists = "no";
    $session_array = explode(";",session_encode());
    for ($x = 0; $x < count($session_array); $x++) {
        $name  = substr($session_array[$x], 0, strpos($session_array[$x],"|"));
        if (session_is_registered($name)) {
            session_unregister('$name');
            $exists = "yes";
        }
    }
    if ($exists != "no") {
        session_destroy();
   }
}
session_clear();
if(!session_is_registered(session_name())) {
    header("Location: index.php");
}else{
   echo"<h1 style=\"color:red;\">NOT Logged Out</h1>";
   echo"Please contact the system administrator.";
}
?>

with this code:

Code: Select all
<?php
// Initialize the session.
session_start();

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

// destroy session cookie
if (ini_get("session.use_cookies")) {
    $params = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000,
        $params["path"], $params["domain"],
        $params["secure"], $params["httponly"]
    );
}

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

// redirect to admin home page
header("Location: index.php");
?>

Making that change should fix the issue.

Chris
User avatar
chris
Site Admin
 
Posts: 1088
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron