fazlurr
1/17/2015 - 12:49 AM

How to detect if the user is on localhost in PHP - http://stackoverflow.com/a/2053295

How to detect if the user is on localhost in PHP - http://stackoverflow.com/a/2053295

<?php
$whitelist = array(
    '127.0.0.1',
    '::1'
);

if ( !in_array( $_SERVER['REMOTE_ADDR'], $whitelist ) ) {
    // not valid
}
?>