PDA

View Full Version : Change [URL] tag in vB to additional link information?


Pulsorock
06-12-2002, 06:39 PM
Hello,
I want to modify the code that links to external links on my vB. I think what I need to modify is the [URL] tag. But where can I do this?
For example if a user place a link to www.yahoo.com I want it to change it automatically to www.domain.com/redir.php?url=www.yahoo.com

scsa20
06-12-2002, 07:37 PM
more then likely, that tag is in the admin/functions.php file.

anyone, please correct me if I'm wrong...anyways...in admin/functions.php, look for


return "<a href=\"$righturl\" target=\"_blank\">".str_replace('\"', '"', $hyperlink)."</a>"


and replace it with


return "<a href=\"www.domain.com/redir.php?url=$righturl\" target=\"_blank\">".str_replace('\"', '"', $hyperlink)."</a>"


like I said, I don't know if it's that you change or something else...sorry for not being more of a help :(

Pulsorock
06-13-2002, 01:51 AM
Thanks.... I'll try it.

Pulsorock
06-13-2002, 02:11 PM
It worked fine....
But unfortunately when is on a link that passes more than one variable thru the URL the redirect doesn't work as it supposed.
For example it works great like this:
www.domain.com/redirect.php?url=http://www.yahoo.com or www.domain.com/redirect.php?url=http://google.yahoo.com/bin/query?p=pulsorock
but if the link refer has more than one variable in the URL like this: www.domain.com/redirect.php?url=http://google.yahoo.com/bin/query?p=pulsorock&hc=0&hs=0
it doesn't work, because when the other variable is called in the URL by the "&" my redirect script thinks is another variable and doesn't count it as the whole URL. The redirected URL by the script is http://google.yahoo.com/bin/query?p=pulsorock instead of the whole URL that is http://google.yahoo.com/bin/query?p=pulsorock&hc=0&hs=0.
Here is the part of my script that generates the redirect, maybe someone can tell me what can I do to fix this.
<?
$link_url = $url;

//Here goes the code that inserts the url to mysql//

header("Location: ".$link_url);
exit;
?>
Thanks

scsa20
06-13-2002, 08:16 PM
okey, I think I know what you need to do....do a search for the following in the same file you just edit..


$righturl = "http://$righturl";


and remove the http:// so it'll look like:


$righturl = "$righturl";


then replace:


//one of them your useing, pic which one your using now
//old one...the non edited one I mean
return "<a href=\"$righturl\" target=\"_blank\">".str_replace('\"', '"', $hyperlink)."</a>"
//new one...the one that you probly replace from what I told you on the other post
return "<a href=\"www.domain.com/redir.php?url=$righturl\" target=\"_blank\">".str_replace('\"', '"', $hyperlink)."</a>"


and replace whatever one with:


return "<a href=\"http://www.domain.com/redir.php?url=$righturl\" target=\"_blank\">".str_replace('\"', '"', $hyperlink)."</a>"


it should work now