Jump to content

Archived

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

AV1611

can PHP do this?

Recommended Posts

I need a clause in a script that if it's false, the window displays a message for a few seconds then the browser popup closes, but if it's false, the page continues loading...

I'm doing this, but it's a bad idea, and doesn't give the pause first...

optionally, can window.close be delayed?

Here is what I am currently doing...

//code:

IF ($row=mysql_fetch_array($result0))
{
$_SESSION['auth']='auth';
$_SESSION['UserID']=$UserID;
$_SESSION['pass']=$pass;
}
ELSE
{
print "SORRY, YOU ARE NOT AUTHORIZED TO CLONE PARTS";
echo '<BODY onLoad="window.close()">';
}
echo "<body>";

Share this post


Link to post
Share on other sites
I changed to this and it a little better, but it's still hokey...
//code:
IF ($row=mysql_fetch_array($result0))
{
$_SESSION['auth']='auth';
$_SESSION['UserID']=$UserID;
$_SESSION['pass']=$pass;
}
ELSE
{
print "SORRY, YOU ARE NOT AUTHORIZED TO CLONE PARTS";
echo "<BODY onLoad=\"alert('Invalid Password');window.close()\">";
}

Share this post


Link to post
Share on other sites
Use a meta-refresh tag and set the time delay (5 sec inthe example).

ELSE
{
print "SORRY, YOU ARE NOT AUTHORIZED TO CLONE PARTS";
echo "<meta http-equiv='refresh' content='5; url=gotothispage.php'>";
}

Share this post


Link to post
Share on other sites
Barand, that is what I used to do, but the parent page of the popup is not the page I want it to go to. In other words, the main menu opens up a new browser that open up the popup. what that did is load the main page in a child from the starting page... I actually want to close the popup AND the child so you are back to the parent browser and main menu...

Does that make sense?

Share this post


Link to post
Share on other sites
You could use javascript's setTimeout() to call window.close after a specified time period.

eg

<BODY onload='setTimeout("window.close()", 5000);'>

Share this post


Link to post
Share on other sites
Perfect!

[!--quoteo(post=361899:date=Apr 5 2006, 05:12 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Apr 5 2006, 05:12 AM) [snapback]361899[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You could use javascript's setTimeout() to call window.close after a specified time period.

eg

<BODY onload='setTimeout("window.close()", 5000);'>
[/quote]

Share this post


Link to post
Share on other sites

×

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.