Jump to content

How to make a simple time limited access script?


Greg_R

Recommended Posts

Fair warning, I know nothing of php syntax, only what I need to do.  ;D

 

I know that

 

echo date("l, F d, H:i");

  will get us:

Saturday, August 04, 16:47

 

So, what I need to end up with is something like:

 

"if day of week is saturday or sunday OR time is less than 7:30am AND greater than 3:30pm, go to afterhours.htm

else

go to businesshours.htm"

 

Can anyone help me with that?

 

Which is fine, I do have a snippet that would put me on the right track with that, but it doesn't take into account days of the week, or minutes:

 

echo "<script language=\"javaScript\" type=\"text/javascript\">\r\n"
. "todaydate = new Date();\r\n"
. "timeis=todaydate.getTime();\r\n"
. "todaydate.setTime(timeis);\r\n"
. "houris = todaydate.getHours();\r\n"
. "if(houris<=15 && houris>7) {\r\n"
. "location.href='http://www.website.org/main/businesshours.htm';\r\n"
. "}\r\n"
. "else{\r\n"
. "location.href='http://www.website.org/main/afterhours.htm';\r\n"
. "}\r\n"
. "</script>\r\n"
. "</span>\r\n";

Archived

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

×
×
  • 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.