PDA

Click to See Complete Forum and Search --> : External Link Change


dclamp
Feb 14th, 2007, 04:37 PM
Im not sure if PHP can do this... but...

I want to check to see if there are external links on my pages and if there are, i want it to point to a framed page of mine with a url like this:

http://www.rapidfriends.com/external.php?url=http://www.vbforums.com

I just want to know how i can have it automaticly change the url from:
http://www.vbforums.com

to

http://www.rapidfriends.com/external.php?url=http://www.vbforums.com

kows
Feb 14th, 2007, 06:42 PM
you basically build a regular expression to handle URLs and use a function to replace regular URLs that are found with your redirection URL built-in to it (you can use preg_replace). if you do not allow html and have your own type of code (like bbcode: for example, [url=http://blah.com] or whatever), then you can easily add your external redirection page while parsing the URL stuff. otherwise, you'll have to just find a good regular expression that will work for it.

CornedBee
Feb 14th, 2007, 08:30 PM
Um ... there are legal issues with that. You cannot present pages not under your control within your own frameset - it violates copyright (or something), and there's precedent at least here in Austria.

kows
Feb 14th, 2007, 09:12 PM
Google does this, as do countless other websites. I don't see how you're going to get sued by someone over this.. Austria must be pretty weird.

CornedBee
Feb 15th, 2007, 07:43 AM
Not at all. Pretty much the same laws are in effect in Germany - there just hasn't been a lawsuit over it yet.

I can't recall the exact details. I think for this to apply the outer site must suggest (visually only suffices) that the inner site is part of the outer - for example, by providing a header or a border.
Google makes it very clear that the site shown is not, in fact, part of Google.

Legal issues aside, why would the OP want to do this anyway? Frames are bad, and making all external links go into a frameset is annoying.

kows
Feb 15th, 2007, 10:16 AM
of course it's annoying, but I suppose it's a way that some sites can put up their advertisements for people visiting sites outside of their own -- at least, that's the only way I've seen it used apart from Google's use. I assume that any site just tracking outgoing users would log the location, remote address and other information and then redirect them. I don't think you should be using frames for this unless you have something to show your user, really.. and even then, like CornedBee said, frames are bad and this would be rather annoying.

CornedBee
Feb 15th, 2007, 10:51 AM
The advertisements around foreign sites might well be problematic.

dclamp
Feb 15th, 2007, 05:26 PM
ok. i guess i will avoid doing this then, thanks for the suggestions though. ;)