Page 1 of 1 1
Topic Options
#57357 - 2001-07-18 01:39 PM LOGIN TIME!!!
Saleem Offline
Hey THIS is FUN
*

Registered: 2001-04-11
Posts: 280
Loc: UAE
I would like to skip a particular portion of the script if the user is logging again to the system within five minutes. Help is much appreiciated.
_________________________
“I’ll not change you unless you don’t have intention to change yourself” --H:Quran

Top
#57358 - 2001-07-18 02:12 PM Re: LOGIN TIME!!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
most easily it's done by filecheck.
example to %windir%\temp

write 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 Offline
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 ]

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#57360 - 2001-07-21 06:44 AM Re: LOGIN TIME!!!
Saleem Offline
Hey THIS is FUN
*

Registered: 2001-04-11
Posts: 280
Loc: UAE
Thanx yar... (budy) thank u very much...it's working like a charm..
_________________________
“I’ll not change you unless you don’t have intention to change yourself” --H:Quran

Top
#57361 - 2001-07-21 07:21 AM Re: LOGIN TIME!!!
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
Page 1 of 1 1


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

Who's Online
0 registered and 857 anonymous users online.
Newest Members
JimDunn, fgarcia, Viginette, ManuvdWielNL, Sir_Barrington
17890 Registered Users

Generated in 0.054 seconds in which 0.024 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