Jump to content

[SOLVED] Closing my greybox after login


jandante@telenet.be

Recommended Posts

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?

Link to comment
Share on other sites

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>

 

Link to comment
Share on other sites

  • 1 year later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.