You would need to use a regular expression to check the string begins with 192
:
<?php
if (!preg_match('/^192/', $_SERVER['REMOTE_ADDR'])) {
header('HTTP/1.1 403 Forbidden');
header('Location: notallowed.php');
exit;
}
I’m also sending a 403
status code to be RESTful.