kkiboo Posted July 23, 2010 Share Posted July 23, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/208664-javascript-inside-php-code-closing-a-popup/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.