Jump to content

PHP Popup Redirect


JohnOP

Recommended Posts

Hi i am looking for a bit of help on a script i am trying to make.

 

Basically i have a page when onload it opens a popup with a random website pulled from the database

 

<script language="JavaScript1.1">
<!--
function TheNewWin(url) {
var popUp = window.open(url,'popup','height=700,width=700,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=200');
if (popUp == null || typeof(popUp)=='undefined') {   
   var a = confirm('Please disable your pop-up blocker and click the "Open" link again.'); 
   if (a){
   window.location.href = 'popupwarn.php';
   }else{
   window.location.href = 'popupwarn.php';
   }
}
else {   
  popUp.focus();
}
}
//-->
</script>
<body onload="TheNewWin($website);">

 

After 10 seconds i have it refresh so the popup changes to a new website

 

header("refresh: 10; websiteviewcontrol.php?id=$website");

 

What i want to happen is before it changes the popup to a new website i want it to redirect to some website of my choice for example Facebook.

So on the 8th second it would go to Facebook then after the 10 it would just reload and get the random website again. The problem im having is i cant get "Some Website" to open in the popup for a few seconds before the reload.

 

 

 

 

Link to comment
Share on other sites

I would change the script and send in two parameters: Website and timeout... so instead of:

<body onload="TheNewWin($website);">

you would have something like:

<body onload="TheNewWin($website,$timeout);">

 

That way you don't actually call your random websites for 10 seconds, you call them for 8, and then call your 'separator' page for 2 seconds, which in turn will call another random website when the time is up...

 

Hope this helps.

 

Link to comment
Share on other sites

I think i understand what you mean but what would the $timeout variable be? i would still need to put the $website variable in the header refresh so it can refresh every 10 seconds but what would the $timeout declare as.

 

I think i need something like this but i can't get the header() to push the 'Seperator' in to the TheNewWin popup that is already opened

 

<?php
header("resfresh 8; $seperator");
//Put that into TheNewWin
header("refresh 10; websiteviewcontrol.php?id=$website");
// will put a new website in TheNewWin

Link to comment
Share on other sites

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.