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 Link to comment https://forums.phpfreaks.com/topic/44136-help-with-links/ 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. Link to comment https://forums.phpfreaks.com/topic/44136-help-with-links/#findComment-214307 Share on other sites More sharing options...
day_tripperz Posted March 24, 2007 Author Share Posted March 24, 2007 Thank you Link to comment https://forums.phpfreaks.com/topic/44136-help-with-links/#findComment-214361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.