vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Change [URL] tag in vB to additional link information? (https://vborg.vbsupport.ru/showthread.php?t=39766)

Pulsorock 06-12-2002 06:39 PM

Change [URL] tag in vB to additional link information?
 
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

PHP Code:

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

and replace it with

PHP Code:

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.
PHP Code:

<?
$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..

PHP Code:

$righturl "http://$righturl"

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

PHP Code:

$righturl "$righturl"

then replace:

PHP Code:

//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:

PHP Code:

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

it should work now


All times are GMT. The time now is 04:59 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01064 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete