Jump to content

Javascript inside PHP code - closing a popup


kkiboo

Recommended Posts

Hey all,

 

I am trying to make it to where when the Log Out link is clicked, it logs the user out, closes the popup window (where the link is) and redirects the parent window to the login page. Here are my codes right now:

 

The logout function (defined in the login script):

if(@$_POST["a"]=="logout" || @$_GET["a"]=="logout")
{
if($auditObj)
  $auditObj->LogLogout();

session_unset();
setcookie("username","",time()-365*1440*60);
setcookie("password","",time()-365*1440*60);
header("Location: login.php");
exit();
}

 

The logout link (found in the popup window page):

<A class=tablelinks href="login.php?a=logout">Log 
out</A>

 

The javascript for the popup window, found in the parent window page:

<script language="JavaScript">
<!--

function Window() {
    window.open("popup.php", "Window", "menubar=no,width=1200,height=550,toolbar=no, resizeable=yes, scrollbars=yes");
}

 

 

Would it be a matter of inserting the echo "<script....."; to put the close window function inside the PHP logout link code? I'm not sure what the best way to do it is, or if it will even work. Thanks for any help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.