View Full Version : problem of closing window and session

12-24-2007, 08:00 AM
Hi all,
i have a page [index.htm] from which i am provinding a link for the login page of application. it opens in a popup[index.php]. all application windows open in this popup. every thing is working absolutely fine. i have a link for logout which on click destroys session and closes the popup. that also works fine but i also want to close index.htm. how will it? :rolleyes:


12-24-2007, 10:25 AM
usually u cannot close a browser window that was opened by the user using javascript, u can however close any browser windows that were opened via javascript subsequently. as always there is a workaround that will work in IE and safari (doesn't fool firefox though..)...by setting the window.opener value to any not null value IE/Safari are fooled into thinking that the browser window was opened by a script and hence allow you to close it using javascript

12-24-2007, 12:19 PM
hi Shyam,
my problem is, when the user clicks on logout, the session doesnt seem to be fully unset() or destroyed. if the user directly types any page url in the address bar of IE it takes the last session values and allows the user to login which is wrong. what exactly should i do? or where am i going wrong

Code of Logout.php

$table_name = 'LoginHistory_T';
$table_values = array(
'LogoutDate_DT' => date('d-M-y h:i:s A')
$sth = $db->autoExecute($table_name, $table_values,DB_AUTOQUERY_UPDATE , " user_id = '$suserid' and session_id='$session_id' ");
//PrintUpdate($table_name , $table_values , "User_ID = '$suserid' and Session_ID='$session_id' ");

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<TITLE> Redirecting ... </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<meta http-equiv="refresh" content="3; URL=<?=$homepath?>">
<TABLE width="60%" cellpadding=5 cellspacing=2>
<td bgcolor="#687DBE" height="30"> <font color=white><b>Redirecting...<b></font></td>
<TD class=table height="200" align=center>Clearing cache.... Clearing cookies .... Clearing session .... <br><br>
You will be automatically redirected to the login page....<br><br>
<A HREF="<?=$homepath?>">Click here if your browser does not automatically redirect you</A>