waverider303 Posted December 10, 2009 Share Posted December 10, 2009 I want to create an if statement that will check through an array for a specific ip address (kind of a anti spam system). <?php /* *$usr_ip - is the ip address pulled from the form *$banned_ip - is the array of ip address's to search through */ if (in_array($usr_ip, $banned_ip)) { die("Banned User!"); } else { } ?> Shouldnt This work? Link to comment https://forums.phpfreaks.com/topic/184660-in_array-help/ Share on other sites More sharing options...
mikesta707 Posted December 10, 2009 Share Posted December 10, 2009 yes But depending on how you generate the array, and how many entries there are, it may be faster to store the IP's on a database and do a query Link to comment https://forums.phpfreaks.com/topic/184660-in_array-help/#findComment-974907 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.