Jump to content

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


dustinto

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
Link to comment
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 :)
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.