This topic is locked

Restricting Access To Phprunner Application By Ip Address

7/11/2013 4:55:08 PM
PHPRunner Tips and Tricks
admin

Restricting or allowing access by IP address is an easy task. Here are a few examples. This code needs to be added to the beginning of AfterAppInit event. Please note that this tutorial uses IPv4 addresses.

  1. Allow local access only

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


2. 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();


3. Restrict access from a certain IP address

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


4. 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();
T
Tayyab Ilyas 7/13/2013

Nice,
This can be a new feature of PHPRunner as well similar to audit trail.

M
mrfdes 1/29/2016

I was looking for a similar thing, however, a function that restricts any IP address from doing something to a form more than once every 24 hours.

I wonder if that is possible, and if so, how it is achieved.

i have made a voting system, and to keep the voting honest I want the votes to be restricted to one vote a day per person.

Any help would be much appreciated.

By the way, i use PHPRunner Enterprise 8.0.

N
nti 2/23/2018

I would assume most phprunner users are working with Comcast? or Att? or other Internet Access provider and our IP addresses are changing several times per year, my ip address does.
I have Comcast as internet access provider.
Assuming we create a new table as "ip_access_table" and populate it with our ip addresses we wish to utilize...
Can you provide example for using "ip_access_table"
Example below for request clarification only...

$array = array(' List of Ip Addresses from ip_access_table ');

if (!in_array($_SERVER['REMOTE_ADDR'], $array)) exit();


The above would provide us a faster method to include/modify our ip addresses when our IP address gets changed...
Thank you.