Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Sample events > Misc

Restrict access to PHPRunner application by IP address

Scroll Prev Next More

 

Restricting or allowing access by an IP address is an easy task. Here are a few examples. The code needs to be added to the beginning of the AfterAppInit event.

 

Note: This tutorial uses IPv4 addresses.

Allow local access only:

if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') exit();

Allow access from the list of approved IP addresses:

$array = array('127.0.0.1', '96.24.12.122', '96.24.12.123');
if (!in_array($_SERVER['REMOTE_ADDR'], $array)) exit();

Restrict access from a certain IP address:

if ($_SERVER['REMOTE_ADDR'] == '123.123.123.123') exit();

Restrict access from the list of addresses:

$array = array('127.0.0.1', '96.24.12.122', '96.24.12.123');
if (in_array($_SERVER['REMOTE_ADDR'], $array)) exit();  

See also:

Security screen

Advanced security settings

Registration and passwords

Active Directory

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software