PDA

View Full Version : Need help with redirect




ptown
Apr 15, 2004, 11:18 AM
I have say, 100 links on a page and when any of the links are clicked,
a redirect page pops up that tells the viewer they are leaving the website and are no longer under the protection of the orignal site. The viewer then has a choice to continue or cancel.

I want to create one redirect page instead of 100. So I need something that will take the url link the viewer has choosen, and place it into the redirect page, and link them to that url when they choose to continue.

Any suggestions would be great. I am guessing it would be PHP script. But I have never used it.

Thanks in advance



GovornorPhatt
Apr 15, 2004, 01:31 PM
I was wondering about this as well. I want to make a similar page to frame external sites, similar to what about.com does at their site. But I don't want to have to make a frameset for each page. Perhaps it uses a referer to direct them to the correct page. A similar use of this type of page is intermidate adversitements that load and make you watch them before you go to the next page in the site.

ptown
Apr 15, 2004, 02:27 PM
I was wondering about this as well. I want to make a similar page to fram external sites, similar to what about.com does at their site. But I don't want to have to make a frameset for each page. Perhaps it uses a referer to direct them to the correct page. A similar use of this type of page is intermidate adversitements that load and make you watch them before you go to the next page in the site.


What do yo mean by "fram external sites"? And do you think this could be accomplished by a Javascript.

GovornorPhatt
Apr 15, 2004, 03:13 PM
What do yo mean by "fram external sites"? And do you think this could be accomplished by a Javascript.

I meant to say frame external sites, as in a top frame or frameset. Excuse my bad typing. An example of this can be viewed here (http://macs.about.com/gi/dynamic/offsite.htm?site=http%3A%2F%2Fseminars.apple.com%2Fseminarsonline%2Findex.html).

Knox
Apr 16, 2004, 04:41 AM
The about.com page is pretty simple to do in PHP, something like the following would work (I haven't worked with frames for years so you'll have to excuse any HTML mistakes, i'm just copying from the about.com page)


<html>
<head><title>Offsite page</title></head>

<FRAMESET ROWS="82,*" FRAMEBORDER=1>
<FRAME NAME="sitetop" SRC="yourheader.html">
<FRAME NAME="sitebottom" SRC="<?php print $_GET["url"]; ?>"
</FRAMESET>

<noframes>
Click here (etc)
</noframes>
</html>


Place that in a file called redirect.php and then when you want to link to an external site you link to redirect.php?url=http://www.apple.com

NB. Generally using an input (the url) without doing any security checking on it is a very bad idea but i'll leave that bit as an exercise to the reader ;)

The original question is really just a variation of this, for example


<html>
<head><title>Offsite page</title></head>
<body>
You are leaving mysite.com.

Do you wish to <a href="<?PHP print $_GET["url"]; ?>">Continue</a> or
<a href="<?PHP print $_GET["r"]; ?>">Return</a> to mysite.com

</body>
</html>


In this case you would add a second parameter to the url, so it would be

redirect.php?url=http://www.apple.com&r=/index.html

You could use the referer instead of passing the "r" parameter but the referer is not guaranteed to work so i tend to prefer passing it manually.