Jump to content


Photo

Close a section of my site at certain times...


  • Please log in to reply
3 replies to this topic

#1 dustinto

dustinto
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 23 March 2006 - 04:55 PM

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

#2 micah1701

micah1701
  • Members
  • PipPipPip
  • Advanced Member
  • 613 posts
  • LocationEllington, CT USA

Posted 23 March 2006 - 06:09 PM

[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");
}
"Confidence in the face of risk."

#3 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 23 March 2006 - 06:11 PM

Something like..

<?php
$closeTime = "1700"; // 5PM
$time = date("GH"); // 24 hour time with leading zero's

if ( $time >  $closeTime ) die ("the website is closed after business hours");
?>

I'm sure you'll want it to be more elaborate.. but you get the idea :)

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/


#4 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 23 March 2006 - 06:45 PM

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.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users