Hello the title is not clear at all I know but here is what I am trying to accomplish : When A User clicks a button I want the page to lock for 24 Hour period nothing fancy just that It will replace the content with an echo message saying to come back in 24 hours and I want it to stay locked for him even after he quits the page, I thought I can accomplish this using sessions but, they could just delete the session cookie and remove the lock timer, right ? ( I might be wrong and that's where I need an expert's opinion ) And then I thought I can do this with Mysql but I can't figure out a way to make it work. Please help, If this is possible in any other method tell me. Thanks in advance, Kind Regards, Issa Shamoun
Its pretty easy. <?php if(isset($_POST['buttonName'])) { mysql_query("INSERT INTO lockdowns (ip, time) VALUES ('{$_SERVER['REMOTE_ADDR']}', '{time()}')"); } $count = mysql_num_rows(mysql_query("SELECT * FROM lockdowns WHERE ip = '{$_SERVER['REMOTE_ADDR']}' AND time > '{time() - 3600}')"); if($count > 0) { die("LOCKDOWN"); } else { // Content of the site when its not locked } ?> PHP: