I have some code that works fine on my local machine running PHP version 4.3.6 but acts funny when I load it on the Web with a host package running PHP version 4.1.2.
It has to do with ending a session and logging out the user. The code:
--start code--
<?
session_start();
if(!isset($_REQUEST['logmeout'])){
echo "<center>Are you sure you want to logout?</center><br />";
echo "<center><a href=logout.php?logmeout>Yes</a> | <a href=javascript:history.back()>No</a>";
} else {
session_destroy();
if(!session_is_registered('first_name')){
echo "<center><font color=red><strong>You are now logged out!</strong></font></center><br />";
echo "<center><strong>Login:</strong></center><br />";
include 'login_form.html';
}
}
?>
--end code--
In both cases, clicking on "Yes" takes me to URL: http://www.foo.com/project/logout.php?logmeout
Now, in PHP version 4.3.6 it triggers the ELSE section and shows that I've logged out. In the online version (PHP version 4.1.2) it just shows the same page again as if nothing happened. Only the URL changes.
Is my code only good in PHP version 4.3.6? Or is something else going wrong?