How do i make a Whitelist IP for a page in html/php?

Hi, i’ve been working on a project’s website and want to make a website. I need a page for the team. and i want to make the non-whitelisted people redirect to the home page. any help?

First, create an array of the IPs:

$ips = array("", "");

Then, detect if one of them visited the page:

if(in_array($_SERVER['REMOTE_ADDR'], $ips)
// Code to run if admin

Great solution. If I may make one suggestion to tidy the potential code of the page…
instead of nesting everything an authorised user can do within the if, just kick all unauthorised users with a 401, then you can have your page code outside the if block:

if(!in_array($_SERVER['REMOTE_ADDR'], $ips))
  header("HTTP/1.1 401 Unauthorized");

// Page code for authorised users

(Notice the not, !, in the if-statement)

But all credit to Riverside for doing the legwork…