Page 1 of 1

Logout dos'nt work with PHP5/IIS6

Posted: Tue Jul 08, 2008 9:21 am
by mickeymick
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();

//also tried this
session_write_close();
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 ? im quite confident abt code cuz same task i done hundarad times but with IIS im using first time bit weared need help guys???????

Re: Logout dos'nt work with PHP5/IIS6

Posted: Tue Jul 08, 2008 9:51 am
by s.dot
You gotta delete the session cookie I'm assuming.

This code should kill the session ;)

Code: Select all

session_start();
 
//empty the session
if(isset($_COOKIE[session_name()]))
{
    setcookie(session_name(), '', time()-42000, '/');
}
if(!empty($_SESSION))
{
    session_destroy();
}
 
$_SESSION = array();