Jump to content

Help with links


day_tripperz

Recommended Posts

Ok im having problems stoping site links being posted on my wap site im using php 4 and i can only manage to stop certain links i want to stop all i use this code to stop one link

$gbvalues=str_replace('http://www.site.co.uk','<img src="image/hatespammers.gif" alt="(hatespammers)',$gbvalues);

and that replaces the link with my hate spammers icon. But it only stops [a href=\"http://www.site.co.uk\" target=\"_blank\"]http://www.site.co.uk[/a] from being put up in the forums. Please help thanks in advanced

Link to comment
Share on other sites

You need to use somethin like preg_replace, with a regular expression similar to:

 

$text=preg_replace('/\[a href\=(.*?)\]/si','<img src="image/hatespammers.gif" alt="(hatespammers)',$gbvalues);

 

That will replace any text that begins with "[a href= until the next ]" and replace it with your image. However, you may need to change this if the actual code the users are entering is or html with < brackets. Good luck.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.