dustinto Posted March 23, 2006 Share Posted March 23, 2006 I have a page I would like to be closed at certain times of the day. Like only allow people to view this durning business hours.I was thinking something that would go like this:IF Time (is greater than) closetime (then)But I would need to figure out how to pull time from the server and make sure it is correct, etc.I would either set-up a header redirect for the (then) or just set something like closed = true and make some more IFs disabling links.This is an dynamic site that has different businesses listed on it (just an fyi). I don't think Ill need help making this work with the site...I just need to know how to use real time.Thanks Quote Link to comment Share on other sites More sharing options...
micah1701 Posted March 23, 2006 Share Posted March 23, 2006 [a href=\"http://www.php.net/date\" target=\"_blank\"]check out the php DATE() function[/a] if(date("G") > 17){exit("SORRY THIS PAGE IS CLOSED BECAUSE ITS PASSED 5PM, SERVER TIME");} Quote Link to comment Share on other sites More sharing options...
keeB Posted March 23, 2006 Share Posted March 23, 2006 Something like..[code]<?php$closeTime = "1700"; // 5PM$time = date("GH"); // 24 hour time with leading zero'sif ( $time > $closeTime ) die ("the website is closed after business hours");?>[/code]I'm sure you'll want it to be more elaborate.. but you get the idea :) Quote Link to comment Share on other sites More sharing options...
txmedic03 Posted March 23, 2006 Share Posted March 23, 2006 I am curious to see why you would want to close the site at night. It is part of the allur of the web based business. While everyone at the brick and mortar is at home asleep you can still show up in your underwear to shop or get information from the website. Sorry, I am just very curious now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.