Page 1 of 1 1
Topic Options
#27317 - 2002-08-18 02:29 PM solved multiple logins and getfiletime
DarrenJ Offline
Lurker

Registered: 2002-08-18
Posts: 2
Loc: New Zealand
I think I may have solved the multiple login problem with users (on NT4 systems)
I look after a school network of anywhere up to 250 users using the system at any point in time, real headache when I disable a user, and they 'borrow' someone elses account.
I had a friend write me a program that runs in the background and writes to the users home share (G:) to a hidden file called "semaphore.dat". The program deletes this file every 5 mins and recreates it, and upon logoff it deletes it totally.
Theory is, that if a 2nd user logs in, I want kixstart to check the file time and if less than 5 mins old then log the 2nd back user out. and if older than 6 mins (1 min margin of error) , then delete and allow the login - this way if a computer crashes and restarts there is only a 5 min wait before the user can log in again (since the semaphore file will still exist).

Now I'm hoping that someone can help, and I manage to pull this off.
I figured uing 'getfiletime' would be the way, but I'm stumped on how to check the age of it. Can anyone help with this? (I'm still a kixstart newbie)

Also - if it does work - is it worth posting the program somewhere for others to use it?

Any help appreciated.

Top
#27318 - 2002-08-18 02:55 PM Re: solved multiple logins and getfiletime
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
darren, I quess the only problem is to count the 5 minutes of the current time...

wait a sec...
_________________________
!

download KiXnet

Top
#27319 - 2002-08-18 03:13 PM Re: solved multiple logins and getfiletime
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
didn't suprisingly find any udf, which would do that, so made my own.
it does not handle day change at all.

code:
$file=right(getfiletime("testi.txt"),8)
$time=@time
? "$file - $time"

$file=3600*val(left($file,2))+60*val(substr($file,4,2))+val(right($file,2))
$time=3600*val(left($time,2))+60*val(substr($time,4,2))+val(right($time,2))

$fileage=$time-$file
"file age in seconds:"
?$fileage
if $fileage>300
?"so, it's older than 5 minutes..."
else
? "it's pretty fresh file, less than 5 minutes."
endif

hope it helps

Lonkero
_________________________
!

download KiXnet

Top
#27320 - 2002-08-20 10:23 PM Re: solved multiple logins and getfiletime
DarrenJ Offline
Lurker

Registered: 2002-08-18
Posts: 2
Loc: New Zealand
It worked!

had to upgrade my Kixstart and rest of my scripts (I think it was version 3.0-something before - which caused a few weird things like printers not behaving)

But everything seems happy now. Students are now restricted to one logon at at time, and in the event of a computer crash, they are locked out for 5 mins (I think I might reduce this to 2 mins)

Thanks for the help!
much appreciated.
[Smile] [Smile]

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 884 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.076 seconds in which 0.056 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org