logger edit
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

logger edit

Started by (master)viper, 01 March, 2005, 18:41:30

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

(master)viper

Hello all. I have this script but i want that only op's and
masters can open the log files. Can somebody edit this for me

-- Stat-logger 0.3 by Troubadour
-- created a seperated config file + gui

-- Stat-logger 0.2 by Troubadour
-- to write all info to a file with the date of that day when users log in (name, e-mail, ip and share)
-- command for viewing the files is !
-- for example !280704 is the command to view the file of 28 juli 2004

-- Stat-logger 0.1 by Troubadour
-- to write all info to a file when a user logs in (name, e-mail, ip and share)
-- command to view the file is !statlog

D = date("%d")
MM = date("%m")
Y = date("%y")

dofile("Stat-logger03.cfg");  -- is used for the settings
statlogfile = ("Data/"..D..""..MM..""..Y..".txt")

function Main()
   frmHub:RegBot(BOTName)
   SendToAll("( >>>>  "..Version.." Started"..date(" the %d/%m-%Y at %X ").."  <<<< )")
end

function DataArrival(user,data)

data=strsub(data,1,strlen(data)-1)
if( strsub(data, 1, 1) == "<" ) then
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
cmd = strsub(cmd, 2,strlen(cmd))
if readfrom("Data/"..cmd..".txt") then
showtext(user, cmd)
return 1
end
elseif(strsub(data, 1, 4) == "$To:") then
s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
cmd = strsub(cmd, 2,strlen(cmd))
if readfrom("Data/"..cmd..".txt") then
showtext(user, cmd)
return 1
end
end
end

function OpConnected(user)
   description,email,share=MyInfoString(user.sMyInfoString)
   local share2 = share / (1024*1024*1024)
   --SendToAll("Stat-logger",user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.." Gb")
   statlogfile = ("Data/"..D..""..MM..""..Y..".txt")
   appendto(statlogfile)
   write("\t","On the "..date("%d").."."..date("%m").."."..date("%y").." - "..date("%H")..":"..date("%M").." - "..user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.."Gb connected \r\n")
   writeto()
end

function NewUserConnected(user)
   description,email,share=MyInfoString(user.sMyInfoString)
   local share2 = share / (1024*1024*1024)
   --SendToAll("Stat-logger",user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.." Gb")
   statlogfile = ("Data/"..D..""..MM..""..Y..".txt")
   appendto(statlogfile)
   write("\t","On the "..date("%d").."."..date("%m").."."..date("%y").." - "..date("%H")..":"..date("%M").." - "..user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.."Gb connected \r\n")
   writeto()

end

function MyInfoString(data)
s,e,description,nada,email,share = strfind(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
return description,email,share
end


function showtext(user, cmd)
lines = "\r\n\r\n"
readfrom("Data/"..cmd..".txt")
while 1 do
local line = read()
if line == nil then
readfrom()
break
end
lines = lines..line.."\r\n"
end
user:SendPM(BOTName, lines.." |")
end


Greatz (MASTER)Viper
Enter The matrix
Dutchmatrix.no-ip.info:3111

TTB

Use thisone:

-- Stat-logger 0.2 by Troubadour 
-- to write all info to a file with the date of that day when users log in (name, e-mail, ip and share)
-- command for viewing the files is #
-- for example #280704 is the command to view the file of 28 juli 2004

-- Stat-logger 0.1 by Troubadour 
-- to write all info to a file when a user logs in (name, e-mail, ip and share)
-- command to view the file is #statlog

D = date("%d")
MM = date("%m")
Y = date("%y")

BOTName = "[BOT]PLAY"
Version = "Stat-logger 0.2"

statlogfile = ("Data/"..D..""..MM..""..Y..".txt")

function Main() 
	frmHub:RegBot(BOTName)
	--SendToAll("( >>>>  "..Version.." Started"..date(" the %d/%m-%Y at %X ").."  <<<< )")
end 

function DataArrival(user,data) 

data=strsub(data,1,strlen(data)-1) 
if( strsub(data, 1, 1) == "<" ) then 
s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
cmd = strsub(cmd, 2,strlen(cmd)) 
--if readfrom("Data/"..cmd..".txt") then 
if readfrom("Data/"..cmd..".txt") and user.bOperator then 
showtext(user, cmd) 
return 1 
end 
elseif(strsub(data, 1, 4) == "$To:") then 
s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)") 
cmd = strsub(cmd, 2,strlen(cmd)) 
--if readfrom("Data/"..cmd..".txt") then
if readfrom("Data/"..cmd..".txt") and user.bOperator then
showtext(user, cmd) 
return 1 
end 
end 
end 

function OpConnected(user)
	description,email,share=MyInfoString(user.sMyInfoString)
	local share2 = share / (1024*1024*1024)
	--SendToAll("Stat-logger",user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.." Gb")
	statlogfile = ("Data/"..D..""..MM..""..Y..".txt")
	appendto(statlogfile) 
	write("\t","On the "..date("%d").."."..date("%m").."."..date("%y").." - "..date("%H")..":"..date("%M").." - "..user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.."Gb connected \r\n")
	writeto()
end

function NewUserConnected(user)
	description,email,share=MyInfoString(user.sMyInfoString)
	local share2 = share / (1024*1024*1024)
	--SendToAll("Stat-logger",user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.." Gb")
	statlogfile = ("Data/"..D..""..MM..""..Y..".txt")
	appendto(statlogfile) 
	write("\t","On the "..date("%d").."."..date("%m").."."..date("%y").." - "..date("%H")..":"..date("%M").." - "..user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.."Gb connected \r\n")
	writeto()

end

function MyInfoString(data)
s,e,description,nada,email,share = strfind(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)") 
return description,email,share
end


function showtext(user, cmd) 
lines = "\r\n\r\n" 
readfrom("Data/"..cmd..".txt") 
while 1 do 
local line = read() 
if line == nil then 
readfrom() 
break 
end 
lines = lines..line.."\r\n" 
end 
user:SendPM(BOTName, lines.." |") 
end
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

(master)viper

Thanks Works good.  :))


(MASTER)Viper
Enter The Matrix
dutchmatrix.no-ip.info:3111

SMF spam blocked by CleanTalk