Jump to content


Photo

can PHP do this?


  • Please log in to reply
5 replies to this topic

#1 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 04 April 2006 - 06:29 PM

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>";

#2 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 04 April 2006 - 06:42 PM

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()\">";
}


#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 04 April 2006 - 08:11 PM

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'>";
}
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#4 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 04 April 2006 - 08:29 PM

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?


#5 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 05 April 2006 - 10:12 AM

You could use javascript's setTimeout() to call window.close after a specified time period.

eg

<BODY onload='setTimeout("window.close()", 5000);'>
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#6 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 05 April 2006 - 11:54 AM

Perfect!

[!--quoteo(post=361899:date=Apr 5 2006, 05:12 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Apr 5 2006, 05:12 AM) View Post[/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]





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users