We can use the PHP built in function strpos to determine if a string contains specific word(s).
For example, we can detect if the IP address of the current user is in the accepted IP list as below:
<?php $ip_address = $_SERVER['REMOTE_ADDR']; $allow_ips = "127.0.0.1;1.54.115.234"; if (strpos($allow_ips, $ip_address) !== FALSE) echo 'Okay, pass'; else echo "sorry!"; ?> |