Logout dos'nt work with PHP5/IIS6

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mickeymick
Forum Newbie
Posts: 1
Joined: Tue Jul 08, 2008 9:17 am

Logout dos'nt work with PHP5/IIS6

Post 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???????
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: Logout dos'nt work with PHP5/IIS6

Post 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();
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply