GO BACK

Contact Us

5-E / 22 BP , 2nd Floor
Near BK Chowk
121001
Faridabad (Haryana), INDIA

Home Forums WordPress IP address restriction on website Reply To: IP address restriction on website

#1927 Reply

admin
Keymaster

Hi Raven,

First you have to create an array of ip address which you want to allow to access website.

Ex : $ip_array = array(“ip_address1”, “ip_address2”, “ip_address3”);

Now you have to get the client ip address :

$client_ip = $_SERVER[‘REMOTE_ADDR’];

After that you have to check if client ip address exists in your ip address array or not

if(in_array($client_ip, $ip_array)){
// Allowed to access
}
else{
// Not allowed to access
}

Thnaks

img