Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Restrict login by timezone mod

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
StephenD Posted - 09 October 2008 : 04:50:52
G'day, haven't posted here in a long time but still read what's happening almost every day...

Looking to build a mod to restrict certain users from logging in initially outside normal hours but then for different times.

Thinking I should add a TZ_ID to the FORUM_MEMBERS table linked to 2 new tables FORUM_TIMEZONE and FORUM_TIMEZONE_DEF

FORUM_TIMEZONE:
TZ_ID = integer, identity seed, primary key
TZ_DESCRIPTION

FORUM_TIMEZONE_DEF:
TZ_ID = integer
DAYOFWEEK = integer
START = Integer 4 digits eg 0800
STOP = Integer 4 digits eg 1700

Then some code to check the server day of week/time against user on login against their allowed timezone and throw them back with a 'Outside Allowed hours access violation' message.

Anyone see any issues by going this route or is there an easier way. Anyone done something similar already?<
7   L A T E S T    R E P L I E S    (Newest First)
StephenD Posted - 14 October 2008 : 10:04:37
Ok, I ended up with 3 timezones.
1 = 24/7 Unrestricted
2 = 0800 - 1730 Mon-Fri
99 = No Access

I added a TZ int field (default value of 1) to Forum_Members and changed pop_profile to allow Admins to change this variable.

I created a new table FORUM_TZ_DEF

With fields:
TZ_ID int
TZ_START_DAY smallint
TZ_STOP_DAY smallint
TZ_START_TIME varchar(4)
TZ_STOP_TIME varchar(4)

I populated the table like so:

	1	1	1	0000	2400
	1	2	2	0000	2400
	1	3	3	0000	2400
	1	4	4	0000	2400
	1	5	5	0000	2400
	1	6	6	0000	2400
	1	7	7	0000	2400
	2	2	2	0800	1730
	2	3	3	0800	1730
	2	4	4	0800	1730
	2	5	5	0800	1730
	2	6	6	0800	1730



Now working on the code for inc_header and inc_header_short. Need to query vb WeekDay with Hour(Time) + Minute(Time) against this table using the TZ_ID from the member table then allow access.

If Weekday for TZ_ID exists then ... check between start/stop times.
<
Etymon Posted - 09 October 2008 : 20:28:28
Have you thought about setting up these types of users into UserGroups? It sounds like you are dealing with at least three types of users. I think there is some code here on the forums for you to parse out the UserGroup IDs that you are wanting. I mean that after you create each UserGroup you can use the code to identify the UserGroup. I'll look for it. I think I know where it is.

Here. Try these three links to research it:
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=65531&SearchTerms=getGroupMembership(
http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=63846&SearchTerms=getGroupMembership(
http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=62521&SearchTerms=getGroupMembership(

Just a mockup of the thought-process could be like this:

if the sever time is between this and that, then ' Normal business hours
     Allow the "Everyone is Allowed" UserGroup
elseif the server time is between this and that, then ' Overtime business hours
     Allow the "Overtime is Allowed" UserGroup
elseif the server time is between this and that, then ' Weekend business hours
     Allow the "Weekends are Allowed" UserGroup
end if


Above is just a thought-process, you could code it differently to suite your needs of course.

- If worker A is allowed to work overtime and weekends as well as normal hours, then place worker A in all three UserGroups (normal hours, overtime, and weekends).

- If worker B is allowed to work overtime as well as normal business hours but not weekends, then place worker B in just two of the UserGroups (normal hours, and weekends).

- If worker C is only allowed to work normal hours, then place worker C only in one UserGroup (normal hours).

I think I would try that approach first if it were me trying to figure it out for my site.
<
StephenD Posted - 09 October 2008 : 18:37:51
Yes, I want to restrict by Server Time regardless of where the user is. Initially 1 Timezone (perhaps timezone is not a good descriptor) for normal office hours but I can see they will want additional timezones set up for users authorised for overtime and on weekends which is why I suggested the 2 tables - 1 with description.<
Etymon Posted - 09 October 2008 : 11:09:15
I think I misunderstood the problem then.

Do you mean something like this (putting this in offline terms):

The office is located on the east coast (USA). The timezone there is EST. Anyone who calls there after 5 PM EST, regardless of where they are calling from, will get an automated reply from the answering machine because no one is there after 5 PM EST.

Is that what you mean by saying the time is based off of YOUR computer's time?

<
Carefree Posted - 09 October 2008 : 10:42:05
Changing the time or time zone on their computers would be meaningless if the server is comparing the start/stop times to YOUR computer's time. An ability to edit the time zone in their profiles would be necessary for anyone who travels, otherwise they would have to recalculate their time based upon the location they lived when they originally registered.

It would be a lot easier to restrict their login times based upon the first letter of their user name. Then you wouldn't need any additional table or variables.<
Etymon Posted - 09 October 2008 : 10:22:23
Couldn't the users change the time setting on their computers and also change the timezone setting in the profiles to emulate an allowed time?<
Carefree Posted - 09 October 2008 : 06:43:41
Why split it into 2 tables and what's the purpose of a TZ description? Assuming that you want to use different times for weekdays vs weekends (else why DOW?), you'd only need five fields.

To do what you want, I'd make a single new table; include TZ_ID, WEEKDAY_START, WEEKDAY_STOP, WEEKEND_START & WEEKEND_STOP. I'd then add TZ_ID to the member table & put it into the "register.asp" & "inc_profile.asp" files.

Then for implementation, you would query the (TZ_ID field from the member table) & the (TZ's allowed times from the TZ table) in both "inc_header.asp" & "inc_header_short.asp"; compare them to current time and deny/grant access accordingly.<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000 Version 3.4.07