Andy252 Posted January 17, 2007 Share Posted January 17, 2007 I want to add a URL banning feature to my websiteInitially I was just going to ban the full url as entered by the users, however, in some cases the url may change by using ?page=Bla, and therefore would not be identified as a banned url. Instead I need to be able to search the url entered for entries in a mysql database. What function do I need to be using the search the string for banned urls? Link to comment https://forums.phpfreaks.com/topic/34644-searching-a-string/ Share on other sites More sharing options...
Eugene Posted January 17, 2007 Share Posted January 17, 2007 [code=php:0]<?PHP$banned_url = array('umm', 'Bla', 'opr', 'ah');if(in_array($_GET['page'], $banner_url)) {echo "Invalid Access.";exit;}?>[/code]Is that what you mean? Link to comment https://forums.phpfreaks.com/topic/34644-searching-a-string/#findComment-163273 Share on other sites More sharing options...
Hypnos Posted January 18, 2007 Share Posted January 18, 2007 URLs in user content (like posts)? Or URLs that link to your site? Link to comment https://forums.phpfreaks.com/topic/34644-searching-a-string/#findComment-163305 Share on other sites More sharing options...
Andy252 Posted January 18, 2007 Author Share Posted January 18, 2007 OK, Actually I need two seperate script but I don't want to jump the gun.... Users submit URLs via a form on my site, which is then put into MySQL.The first problem is not all the URLs are following the rules are therefore I want to add a banning features. I can't simply ban the domain because for the likes of tripod / geocities it will ban everyone. I also can't ban the full url because urls because users will bypass the banning feature by removing the "www." or adding "?page=1".Instead I need to be able to ban *tripod.com/directory*, or something like *domain.com/~user/*Once I have this in place I need to add a feature that will test the URLs are correct because after looking at my database there are a lot of entries which look like this... http://kljfhigufwuergfosuhailu, or http://0000.Thanks for your help guy ! Link to comment https://forums.phpfreaks.com/topic/34644-searching-a-string/#findComment-163532 Share on other sites More sharing options...
Andy252 Posted January 18, 2007 Author Share Posted January 18, 2007 Anyone ? Link to comment https://forums.phpfreaks.com/topic/34644-searching-a-string/#findComment-163739 Share on other sites More sharing options...
effigy Posted January 18, 2007 Share Posted January 18, 2007 Use regular expressions. Can you provide more examples? Link to comment https://forums.phpfreaks.com/topic/34644-searching-a-string/#findComment-163760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.