day_tripperz Posted March 24, 2007 Share Posted March 24, 2007 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 Quote Link to comment Share on other sites More sharing options...
Hell Toupee Posted March 24, 2007 Share Posted March 24, 2007 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. Quote Link to comment Share on other sites More sharing options...
day_tripperz Posted March 24, 2007 Author Share Posted March 24, 2007 Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.