Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Replace external URLs using PHP
Old 02-13-2009, 02:15 PM Replace external URLs using PHP
Dakoom's Avatar
Experienced Talker

Posts: 42
Name: Norman
Location: [Italy]
Trades: 0
Hello, I would like to know how can I replace all the external links on my vBulletin forum with PHP. Just help me with the PHP part.. thus I will try to let it work with vBulletin myself.

What I want to do? Simple, I want to replace all my external urls like this:

http://www.example.com/

.. to become ..

http://www.myforum.com/external_link...w.example.com/

Where at external_link.php I put a page that says "Hey, you are leaving our forums.. click here to continue:

http://www.example.com/"

Can you please help me?
__________________
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!

Please login or register to view this content. Registration is FREE
Dakoom is offline
Reply With Quote
View Public Profile Visit Dakoom's homepage!
 
 
Register now for full access!
Old 02-13-2009, 03:58 PM Re: Replace external URLs using PHP
Skilled Talker

Posts: 79
Location: Devon, England
Trades: 0
Personally if I was a user of the forum I would find this a annoying. Can I ask why not stick with the traditional method of simply opening a new window?

The only way to achieve what you want though is to dive into your vbulletin code. In the wysiwyg folder there should be a file that deals with creating hyperlinks. In here you should be able to find where it deals with creating the <a> tag when people enter a link. You would have to change it to add your domain at the front.
__________________
Please add to my Talkupation if I was helpful. Thanks.


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
paaaaaaaaaa is offline
Reply With Quote
View Public Profile Visit paaaaaaaaaa's homepage!
 
Old 02-13-2009, 11:42 PM Re: Replace external URLs using PHP
Novice Talker

Posts: 4
Name: Samuel Santos
Trades: 0
Hello!

I have the some problem.
I' found some scripts, and i will to test this weekend, if it work good i will post here for you.

Samuel
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
inglescurso is offline
Reply With Quote
View Public Profile Visit inglescurso's homepage!
 
Old 02-14-2009, 02:29 AM Re: Replace external URLs using PHP
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Doing that is a VERY bad idea, not to mention that it annoys the user more then its worth.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 02-14-2009, 08:58 AM Re: Replace external URLs using PHP
Dakoom's Avatar
Experienced Talker

Posts: 42
Name: Norman
Location: [Italy]
Trades: 0
For example, I would like to try doing something like the one on GaiaOnline:

http://www.gaiaonline.com/gaia/redir...l.com%2Fynldu5

By the way, the main reason I want to do this is just for learn how to do it.
__________________
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!

Please login or register to view this content. Registration is FREE
Dakoom is offline
Reply With Quote
View Public Profile Visit Dakoom's homepage!
 
Old 02-14-2009, 01:25 PM Re: Replace external URLs using PHP
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Quote:
Originally Posted by Dakoom View Post
For example, I would like to try doing something like the one on GaiaOnline:

http://www.gaiaonline.com/gaia/redir...l.com%2Fynldu5

By the way, the main reason I want to do this is just for learn how to do it.
PHP Code:
<?php
header
("Location {$_GET['r']}");
?>
<html>
....
</html>
Its a BAD IDEA, DON'T LEAVE YOUR SITE OPEN TO ATTACKS.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 02-14-2009, 04:15 PM Re: Replace external URLs using PHP
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Quote:
Originally Posted by Decaf View Post
Doing that is a VERY bad idea, not to mention that it annoys the user more then its worth.
I second that, It should only be used when your site's users are total idiots who assume external links are under your control. Which in most cases is 10% of internet users.

Instead, just put some text at the bottom of a link heavy pages saying your not responsible for external websites.

However, if you really want to have a warning page or something. Use a link cloaking out script (like http://www.site.com/out.php?linkid=2234 ) and just keep a list of external links.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE

Last edited by rogem002; 02-14-2009 at 04:17 PM..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 02-14-2009, 04:25 PM Re: Replace external URLs using PHP
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Quote:
Originally Posted by rogem002 View Post
I second that, It should only be used when your site's users are total idiots who assume external links are under your control. Which in most cases is 10% of internet users.

Instead, just put some text at the bottom of a link heavy pages saying your not responsible for external websites.

However, if you really want to have a warning page or something. Use a link cloaking out script (like http://www.site.com/out.php?linkid=2234 ) and just keep a list of external links.
Thank you!
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 02-15-2009, 02:04 PM Re: Replace external URLs using PHP
Dakoom's Avatar
Experienced Talker

Posts: 42
Name: Norman
Location: [Italy]
Trades: 0
There is no other way to do that? Just link cloaking and header location redirect? There is no *secure* way I can do that using a script at external_link.php, for example?
__________________
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!

Please login or register to view this content. Registration is FREE
Dakoom is offline
Reply With Quote
View Public Profile Visit Dakoom's homepage!
 
Old 02-15-2009, 02:15 PM Re: Replace external URLs using PHP
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Quote:
Originally Posted by Dakoom View Post
There is no other way to do that? Just link cloaking and header location redirect? There is no *secure* way I can do that using a script at external_link.php, for example?
The only way to "secure" an open ended redirect script (ex. www.mysite.com/?url=http://google.com ) is to have your redirect script check and only redirect on approved url's, but if your site is for a forum, there is no good way to do this.

Your best bet is to forget about external redirect scripts, they are more annoying to everyone.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 02-15-2009, 06:19 PM Re: Replace external URLs using PHP
Dakoom's Avatar
Experienced Talker

Posts: 42
Name: Norman
Location: [Italy]
Trades: 0
I repeat, I just try to learn. What do you mean with "approved urls"?
__________________
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!

Please login or register to view this content. Registration is FREE
Dakoom is offline
Reply With Quote
View Public Profile Visit Dakoom's homepage!
 
Old 02-15-2009, 08:21 PM Re: Replace external URLs using PHP
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Quote:
Originally Posted by Dakoom View Post
I repeat, I just try to learn. What do you mean with "approved urls"?
"approved url's" would be url's that are known to be good sites (Ex. Google.com, Yahoo.com, Mashable.com) and disallowing redirection to all other sites.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 02-17-2009, 03:45 AM Re: Replace external URLs using PHP
Dakoom's Avatar
Experienced Talker

Posts: 42
Name: Norman
Location: [Italy]
Trades: 0
Then using that method I will need to put one by one each URL I suppose is secure?
__________________
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!

Please login or register to view this content. Registration is FREE
Dakoom is offline
Reply With Quote
View Public Profile Visit Dakoom's homepage!
 
Reply     « Reply to Replace external URLs using PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40790 seconds with 12 queries