Greg_R Posted August 4, 2007 Share Posted August 4, 2007 Fair warning, I know nothing of php syntax, only what I need to do. 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? Quote Link to comment https://forums.phpfreaks.com/topic/63351-how-to-make-a-simple-time-limited-access-script/ Share on other sites More sharing options...
dbillings Posted August 4, 2007 Share Posted August 4, 2007 Probably best to use javascript for that because it will use the users browser time in my humble opinion. Quote Link to comment https://forums.phpfreaks.com/topic/63351-how-to-make-a-simple-time-limited-access-script/#findComment-315700 Share on other sites More sharing options...
Greg_R Posted August 4, 2007 Author Share Posted August 4, 2007 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"; Quote Link to comment https://forums.phpfreaks.com/topic/63351-how-to-make-a-simple-time-limited-access-script/#findComment-315701 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.