WHAT'S NEW?
Loading...

[PHP] How to detect if the user is on localhost?

You can also use $_SERVER['REMOTE_ADDR'] for which IP address of the client requesting is given by the web server.
$whitelist = array(
    '127.0.0.1',
    '::1'
);

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

0 comments:

Post a Comment