I build a dashboard using PHP & MySql, where my company employees can log in, log out, request leaves, add work reports & maintain their attendance. everything was working fine, but my manager wants that dashboard to open only in our office network. Since it's a simple task, I added the below code to the login page.
<?php
$ip = $_SERVER['REMOTE_ADDR'];
if($ip == "xxx.xxx.xxx.xxx")
{
}
else
{
header("Location: error.php");
}
?>
On the error.php page, I added an error message "You are not allowed to access this page".
The IP address I am using is from Google (IPV4). This was working fine but recently I realized the internet IP address changes often. Now the condition is not working. So anyone can help me with which IP address I need to use in the conditions or what will be the solution for this.