hi,
i upload my website on server that using php5/IIS6 and logout function not working code im using for logout is following but its working fine on my local where im using php5/apache.
code:
session_start();
// i also tried to empy session variables
$SESSION['LogedStatus'] = "";
$
SESSION['LogedUser'] = "";
$_SESSION['LogedUserID'] = "";

//also tried to uset session variables
unset($SESSION['LogedStatus']);
unset($
SESSION['LogedUser']);
unset($_SESSION['LogedUserID']);

//also tried to unset session itself
session_unset();

session_destroy();
header("Location: " . $_REQUEST['ru']);

all this code working fine on my local php5/apache2 but on server it dosnt work. plz tell me if i need to do something with php.ini on server or any thing im doing wrong ?

    Try adding a [man]session_write_close/man just before you do the header() (and after you clear out the desired $_SESSION elements.

      thanks for reply
      ya i also did tried session_write_close() ftn. its redirect page to main but not releasing session some how.

        Well, hopefully, PHP5 on IIS6 isn't the problem 🙂

        Did you try using the code from the manual (it tells the browser to remove the session cookie too.)

        Have a look here...

          Are you also sure that it's not your browser's cache? Try echo'ing the current time (including seconds) on a page, go to the logout page, and then see if the old time is still shown after the redirect.

            try removing your header re-direct and either manually go to the other page, or use a meta re-direct. just an idea to help determine what may be really causing the problem.

              I've used this code on several servers without problem

              <?php
              
              session_start();
              
                 // set all $_SESSION values to blank
              $_SESSION = array();
              
              // checks to see if session is still stored, if so make it expire 100000 seconds ago
              if(isset($_COOKIE[session_name()])){
              	setcookie(session_name(), '', time()-100000, '/');
              }
              
              // Just to be sure its gone, blow it up
                 session_destroy();
              
                  //ok, its gone, lets move on
              header("Location: whatever.php");
              
              ?>
              
                Write a Reply...