Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for login_log_ip_mac.kix

(view source code of login_log_ip_mac.kix as plain text)

  1. ; Get the current date in YYYYMMDD format
  2. $Today = "@YEAR" + Right( "0@MONTHNO", 2 ) + Right( "0@MDAYNO", 2 )
  3. ; Create the directory if it doesn't exist
  4. If Exist( "\\Server\Logs\$Today\*.*" ) = 0
  5. 	MD "\\Server\Logs\$Today"
  6. EndIf
  7.  
  8. ; Read the first IP address
  9. $IP = Join( Split( @IPAddress0, " " ), "" )
  10. ; Check if there are more, and join them all using semicolons
  11. For $i = 1 To 3
  12. 	$RC = Execute( "If @@IPAddress$i > '' $$IP = $$IP + Chr(59) + Join( Split( @@IPAddress$i, ' ' ), '' )" )
  13. Next
  14. ; Log the results
  15. If RedirectOutput( "\\Server\Logs\$Today\@USERID.log" ) = 0
  16. 	"$IP,@ADDRESS@CRLF"
  17. 	$RC = RedirectOutput( "" )
  18. EndIf

page last uploaded: 2021-01-27