Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 17th, 2004, 03:24 PM
Authorized User
 
Join Date: Aug 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Tachyon
Default logging out of a session

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><strong>You are now logged out!</strong></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?

__________________
An overworked Web Developer who\'s expected to know everything yet given time to study nothing.
 
Old June 23rd, 2004, 09:30 PM
Registered User
 
Join Date: Jun 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this:
http://www.foo.com/project/logout.php?logmeout=true

Notice the "=true" appended to the URL. GET variables usually need a value to be recognized as true (as does any other variable). This may be a PHP.INI directive or a new feature/update in PHP 4.3.6






Similar Threads
Thread Thread Starter Forum Replies Last Post
Session expires at logging messages using Log4Net nadigadda .NET Framework 1.x 0 May 2nd, 2007 04:32 PM
Session expires at logging messages using Log4Net nadigadda .NET Framework 2.0 0 May 2nd, 2007 04:29 PM
SSIS - Built-In Logging / Custom Logging ivobecker23 SQL Server 2005 0 April 21st, 2006 05:41 AM
Redirecting and Logging off. rupen Classic ASP Basics 3 June 6th, 2005 07:19 AM
Session expires imediately on logging in codebuyer Classic ASP Professional 3 February 24th, 2005 02:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.