Hi All,

I want to randomly select a desitniation page and use cookies to ensure that
refreshes and return visits on the same machine always return to that
desination (assuming the cookie is intact).

Imagine that we have an array of URL's

$url=array(1=>"dest1.html", "dest2.html", "dest3.html"); // I'm using the
1=> so that I don't need to store 0 in a cookie!

and that we have a variable $index which has a value in it (either set to a
cookie value, if this is a refresh or return visit, or a random value [1-3]
if this is the first visit

My question is are there problems with:

<?php
header("Location: ".$url[$index]);
?>

Might some browsers fail to redirect to the required destination?
If so under what circumstances?
Can I use "belt and braces" and employ HTML and javascript methods
afterwards without introducing problems?

i.e.
<?php
header("Location: ".$url[$index]);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<SCRIPT>
<!--
window.location.replace="<?php echo $url[$index]; ?>";
window.location="<?php echo $url[$index]; ?>"; // for NS <= 2.x no support
for replace
// -->
</SCRIPT>
<meta http-equiv="REFRESH" content="0;URL=<?php echo $url[$index]; ?>">
<TITLE>Forward Page</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<frameset cols='100%,*' border='0' framespacing='0' frameborder='NO'>
<FRAME SRC='<?php echo $url[$index]; ?>' NAME='mainframe' FRAMEBORDER='0'
NORESIZE='noresize' SCROLLING='AUTO'/>
<FRAME src="blank.html" FRAMEBORDER='0' SCROLLING='NO' NORESIZE='noresize'/>
</frameset>
<NOFRAMES>
<BODY>
Your browser appears not to support any form of automatic redirect. Please<a
href="<?php echo $url[$index]; ?>">click
here</a> to be redirected to the web site.
</BODY>
</NOFRAMES>
</HTML>

Any comments or suggestions would be greatly appreciated.

Henry

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to