Steve,
Actually, I was referring to the passcode that allows someone to access the web application from outside of AMPR (currently '1234' for testing).
Of course I don't mind sharing the code that looks at the source IP; and if not 44/8, prompts for a passcode.
I used ip2long to convert 44.0.0.1, 44.255.255.255 and the source IP into integers. I then used a 'nested if' statement in the program to test if the source IP was greater than or equal to 44.0.0.1 and less than or equal to 44.255.255.255; if so, it automatically provides the passcode, if not, it prints an additional box, asking for a passcode.
{ $ip = $_SERVER['REMOTE_ADDR']; $amprtop = "44.0.0.1"; $amprlow = "44.255.255.255"; $longip = ip2long($ip); $rangetop = ip2long($amprtop); $rangelow = ip2long($amprlow); $code = 1234; $access = $_GET['access']; };
// (other portions removed)
If (($longip >= $rangetop) && ($longip <= $rangelow)) { echo '<input type="hidden" name="access" value="'.$code.'"></input>'; } else { echo ' Enter NonAMPR Access Code: <input type="text" name="access" value="'.$access.'"></input>'; }
-KB3VWG