#57358 - 2001-07-18 02:12 PM
Re: LOGIN TIME!!!
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
most easily it's done by filecheck. example to %windir%\tempwrite on every logon in the end of script:
code:
run "%comspec% /c echo @date > %windir%\temp\@userid" run "%comspec% /c echo @time >> %windir%\temp\@userid"
and check it before:
code:
if exist("%windir%\temp\@userid") $ = open(1,"%windir%\temp\@userid") $day = readline(1) $time = substr(readline(1),1,5) $ = close(1) if $day = @date ;if same day if (val(substr($time,1,2)) = val(substr(@time,1,2)) and val(substr($time,4,2))+6 > val(substr(@time,4,2))) or (val(substr($time,1,2))+1 = val(substr(@time,1,2)) and val(substr($time,4,2)) > val(substr(@time,4,2))+54) ;here put what you want to do endif endif endif
something like that. there is time calculation scripts for exact times too, this is pretty rough, which I think, sits in this situation.
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#57359 - 2001-07-19 04:34 AM
Re: LOGIN TIME!!!
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,We have create also a script which is using a general file on your server. Each time it will read the previous logon information. The result will be the variable $run_full_script, which will set to "no" by a new logging on within 5 minutes. You may modify the value of variable $log_file to another location on your server. Our script.
code:
:script_logging $log_file="c:\last_logon.txt" $time_previous=ReadProfileString($log_file,"logon",@userid) ; - @date @time @wksta - $time_current=@date+" "+@time+" "+@wksta IF (WriteProfileString($log_file,"logon",@userid,$time_current) <> 0) ? "Error UpdateLogonInfo @error: @serror" ENDIF ; $run_full_script="yes" IF (len($time_previous) <> 0) $time_previous=60*Val(substr($time_previous,12,2))+Val(substr($time_previous,15,2)) $time_current=60*Val(substr($time_current,12,2))+Val(substr($time_current,15,2)) IF (substr($time_previous,1,10) = substr($time_current,1,10)) ; - same day? - $time_period=$time_current-$time_previous ELSE $time_period=$time_current+(24*60-$time_previous) ENDIF IF ($time_period < 5) $run_full_script="no" ELSE $run_full_script="yes" ENDIF ENDIF ; ? "run full script: "+$run_full_script+" (previous logon: "+$time_period+")" IF ($run_full_script = "yes") ; ; - your code - ; ENDIF EXIT
The $log_file can contain following information:
code:
[logon] MCA=2001/07/19 00:07:37 W2K User1=2001/07/19 00:27:32 W95 User2=2001/07/19 00:17:35 NT4
Greetings.[ 19 July 2001: Message edited by: MCA ]
|
|
Top
|
|
|
|
#57361 - 2001-07-21 07:21 AM
Re: LOGIN TIME!!!
|
Anonymous
Anonymous
Unregistered
|
I can another use for this... logon by the same USERID but diff servers!... could be used as a Security log dependin on the travel distance between sites! ?
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 857 anonymous users online.
|
|
|