#27317 - 2002-08-18 02:29 PM
solved multiple logins and getfiletime
|
DarrenJ
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
|
|
|
|
#27319 - 2002-08-18 03:13 PM
Re: solved multiple logins and getfiletime
|
Lonkero
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
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.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 837 anonymous users online.
|
|
|