Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6133179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:11:43+00:00 2026-05-23T17:11:43+00:00

i need to make my users aware that they are clicking an external link.

  • 0

i need to make my users aware that they are clicking an external link. I have many sorts of chats on my website and sometimes users post links, these links could be dangerous for them so i wanted to warn them before leaving the site.

For example eveonline.com uses the following on their forums: http://www.eveonline.com/externalLink.aspx?l=http://altdevblogaday.com/2011/07/11/the-hidden-evil-of-the-micro-transaction/

whenever a link shows up they see if the domain is different than eveonline.com and if it is they add the “http://www.eveonline.com/externalLink.aspx?l=” to it.

This is my makeClickableLinks function, i use it to make links clickable, i was wondering if someone could rewrite if for me to do the above + clickable as i didnt write this function since i am clueless with preg_match.

function makeClickableLinks($text)
    {
    $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','<a target="_blank" href="\\1">\\1</a>', $text);

    $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1<a target="_blank" href="http://\\2">\\2</a>', $text);


    return $text;
    }

the variable $text is the post of the user.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:11:43+00:00Added an answer on May 23, 2026 at 5:11 pm

    I’m no PHP wizard, but give this a try. Note that almost all of this is taken straight out of the PHP manual here.

    function makeClickableLinks($text)
    {
        $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
                              '<a target="_blank" href="\\1">\\1</a>', $text);      
    
        $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
                              '\\1<a target="_blank" href="http://\\2">\\2</a>', 
                              $text);
    
        $regex = '@(<a.*?href=")((?!(?:(?:f|ht)tps?://)?(?:[a-z0-9]+\.)?domain\.com)[^"]*)@i';
        $replacement = '$1http://your.domain.com/externLink.php?l=$2';
    
        $text = preg_replace($regex, $replacement, $text);
    
        return $text;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a pop-up window for users to log-in to my website
I'm working on emedding SMF users into current website, and I need to make
I need to make sure that user can run only one instance of my
Well i need to make it so any user can have a foo.com/username in
I have a crystal report file I need make a tiny edit in. It
I need to make an ArrayList of ArrayLists thread safe. I also cannot have
i have a website which i want my users to access from their iphones
I have a vb.net web app, and I need to give my users the
I need to make a WebCast presentation soon and need to do some whiteboarding
I need to make an application in .NET CF with different/single forms with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.