jandante@telenet.be Posted January 23, 2009 Share Posted January 23, 2009 Hi, I wonder if there is any simple solution for the following. I have a login script (existing script modified for my site) that pops up in greybox (found at: orangoo.com/labs/GreyBox/). When clicked on Login a function is called which checks if the login is correct an then goes to a page. This is written in PHP. To refer to an page the following code is used => header ("Location: index.php"); This is working but off course the referral page is opened inside the greybox. I would like the greybox to close and the index.php page to reload. You can see what I'm trying on www.mypersonalad.org click "Aanmelden" in the upper left corner. Login: "testing" pass: "test". Please don't hack I have only heard about injection and have no protection for the moment. That's for later. I've tried adding code like this in php => header("Location: index.php onclick=\"parent.parent.GB_hide();\""); But that is not working. My thoughts are that I should check in my login page (the one in greybox) if the user is already logged in. If he is logged in give a message like: "You are now logged in. This page closes automatically in 2 seconds". But I don't know how to do this. Any help please? Quote Link to comment Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 the php Header function is used to send the client browser additional paramters, unfortunately javascript is not involved, it is only for static strings. You could forward the client after logging in (in the greybox) to a simple page like this: <html> <body onload="parent.window.reload();document.window.close()"> Javascript must be disabled to see this message i guess. </body> </html> The javascript portion in the onload parameter is almost definetely wrong, i'm not actually v good with javascript but you should get the general idea. Hope this helps, EDIT---- <?php // Redirect to a simple page Header("Location: ./greyboxclose.html"); ?> greyboxclose.html <html> <body onunload="window.opener.location.reload();"> Thank you for logging in:<br /> Please Close This Window. </body> </html> Quote Link to comment Share on other sites More sharing options...
jandante@telenet.be Posted January 23, 2009 Author Share Posted January 23, 2009 Hi, thanks for the reply. I found a solutions probably similar to yours: When the loginform loads it now checks if you are logged in. If so i put the following javascript: <script language=\"javascript\" type=\"text/javascript\"> top.location.href=\"index.php\"; </script> This works perfect for me. Quote Link to comment Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 im glad you sorted it. Please mark resolved Quote Link to comment Share on other sites More sharing options...
shashidharkumar Posted December 20, 2010 Share Posted December 20, 2010 Pleas go through this file (gb_scripts.js) at line number 12 change 'this.reload_on_close=false;' to 'this.reload_on_close=true' and line number 67 change 'window.location.reload();' to 'window.location.reload(true);' and done Quote Link to comment 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.