Jump to content

Archived

This topic is now archived and is closed to further replies.

dustinto

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

Recommended Posts

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

Share this post


Link to post
Share on other sites
[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");
}

Share this post


Link to post
Share on other sites
Something like..

[code]
<?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");
?>
[/code]

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.