If the user has switched on the maintenance mode, the system should record the user ip and from this point allow access only if the maintenance mode is disabled.
Above was what I needed for the website. Below I use:
<?php session_start(); if ($_SESSION[last_ip]!==$_SERVER[REMOTE_ADDR]) { $_SESSION[ips] = (!is_numeric($_SESSION[ips])) ? 1 : $_SESSION[ips] + 1; $_SESSION[last_ip] = $_SERVER[REMOTE_ADDR]; } if ($_SESSION[ips]===1) { echo "Static IP"; } else { echo "Dynamic IP"; } ?>
According to the posted answers (long time ago, sry ') it is almost impossible to achieve this. For me it works ... if I get nothing.
Ruudie
source share