Stat-logger 0.3a
 

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

Stat-logger 0.3a

Started by Dessamator, 08 June, 2005, 14:57:17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dessamator

--Lua 5 By Dessamator 
-- Stat-logger 0.3b
-- fixed error in saving logs(report by TTB)
-- added !lastips(request by Penguin)

-- 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
a={}

MaxLogins = 15

function Main() 
--statlogfile = "Data/"..os.date("%d%m%y.txt")

if io.open("Stat-logger03.cfg","r") then   -- is used for the settings
	dofile("Stat-logger03.cfg")
else
	BOTName = "Stat-logger"
	Version = "Stat-logger03"
end
	frmHub:RegBot(BOTName)


	if not io.open("Data/check.dat","r") then
		os.execute("mkdir Data")
		io.output("Data/check.dat")
		io.close()
		io.output()
		
	end
	SendToAll("( >>>>  "..Version.." Started"..os.date(" the %d/%m-%Y at %X ").."  <<<< )")
end 

function ChatArrival(user,data) 
	
data=string.sub(data,1,-2) 
s,e,cmd = string.find(data,"%b<>%s+(%S+)") 
local n,temp=0,"The last "..MaxLogins.."logged users\r\n"
	if cmd =="!lastips" then
		for line in io.lines("Data/"..os.date("%d%m%y.txt")) do
			table.insert(a, line)
		end
		for i=table.getn(a),1, -1 do
			if n%s+(%S+)") 
cmd = string.sub(cmd, 2,string.len(cmd)) 
	if io.open("Data/"..cmd..".txt") then 
		showtext(user, cmd) 
		return 1 
	end 
	
end 


function OpConnected(user)
	description,email,share=MyInfoString(user.sMyInfoString)
	local share2 = string.format("%0.2f",(share / (1024*1024*1024)))
	--SendToAll("Stat-logger",user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.." Gb")
	statlogfile = "Data/"..os.date("%d%m%y.txt")
	file=io.open(statlogfile,"a+") 
	file:write("\t","On the "..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - "..user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.."Gb connected \r\n")
	file:close()

end

NewUserConnected = OpConnected

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


function showtext(user, cmd) 
	lines = "\r\n\r\n" 
	for line in io.lines("Data/"..cmd..".txt") do 
		if line == nil then 
		break 
		end 
		lines = lines..line.."\r\n" 
	end 
	io.close()
	user:SendPM(BOTName, lines) 
end
Ignorance is Bliss.

TTB

Nice one...

but the script in LUA4 had one point that didn't work very well... The filenames that are used is the date of a day. When not restarting the scripts, the next day is also logged in the previous dayfile.

I will not use this script, because I run RC with also this feature (something like it)...
TTB

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

Dessamator

QuoteOriginally posted by TTB
Nice one...

but the script in LUA4 had one point that didn't work very well... The filenames that are used is the date of a day. When not restarting the scripts, the next day is also logged in the previous dayfile.

I will not use this script, because I run RC with also this feature (something like it)...

hmm ,well id say its similar to optimus ip logger, but this one's better, hehe, its got !lastip :)

but if ur using that ip logger this wouldnt be of much use, except when i add a new feature !
Ignorance is Bliss.

Dessamator

#3
----> Stat-Logger 0.4a By Dessamator
-- Added Search Log(!searchlog)
-- Added SendTo (request by Penguin )
----> Stat-logger 0.3b
-- fixed error in saving logs(report by TTB)
----> Stat-logger 0.3a 
-- Added !lastips(request by Penguin)
-- Lua 5 by Dessamator
----> 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


a={}
MaxLogins = 15
SendTo = 2 -- (1 =>MainChat 2=>PM, 3=>Main and pvt (request by Penguin)

function Main() 
--statlogfile = "Data/"..os.date("%d%m%y.txt")

if io.open("Stat-logger03.cfg","r") then   -- is used for the settings
	dofile("Stat-logger03.cfg")
else
	BOTName = "Stat-logger"
	Version = "Stat-logger03"
end
	frmHub:RegBot(BOTName)


	if not io.open("Data/check.dat","r") then
		os.execute("mkdir Data")
		io.output("Data/check.dat")
		io.close()
		io.output()
		
	end
	SendToAll("( >>>>  "..Version.." Started"..os.date(" the %d/%m-%Y at %X ").."  <<<< )")
end 

function ChatArrival(user,data) 
	
data=string.sub(data,1,-2) 
s,e,cmd = string.find(data,"%b<>%s+(%S+)") 
s,e,ip = string.find(data,"%b<>%s+%S+%s+(%S+)") 
local n,temp=0,"The last "..MaxLogins.."logged users\r\n"
	if cmd =="!lastips" then
		for line in io.lines("Data/"..os.date("%d%m%y.txt")) do
			table.insert(a, line)
		end
		for i=table.getn(a),1, -1 do
			if n%s+%S+%s+%S+%s+(.+)")
		findloggedip(user,ip, date)
		return 1
	end
	cmd = string.sub(cmd, 2,string.len(cmd)) 
	if io.open("Data/"..cmd..".txt") then 
		showtext(user, cmd) 
		return 1 
	end 
end


function ToArrival(user,data)
s,e,cmd = string.find(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)") 
cmd = string.sub(cmd, 2,string.len(cmd)) 
	if io.open("Data/"..cmd..".txt") then 
		showtext(user, cmd) 
		return 1 
	end 
	
end 


function OpConnected(user)
	description,email,share=MyInfoString(user.sMyInfoString)
	local share2 = string.format("%0.2f",(share / (1024*1024*1024)))
	--SendToAll("Stat-logger",user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.." Gb")
	statlogfile = "Data/"..os.date("%d%m%y.txt")
	file=io.open(statlogfile,"a+") 
	file:write("\t","On the "..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - "..user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.."Gb connected \r\n")
	file:close()

end

NewUserConnected = OpConnected

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


function showtext(user, cmd) 
	lines = "\r\n\r\n" 
	for line in io.lines("Data/"..cmd..".txt") do 
		if line == nil then 
		break 
		end 
		lines = lines..line.."\r\n" 
	end 
	io.close()
	user:SendPM(BOTName, lines) 
end

function findloggedip(user,ip,date)
local found,check,log ="\r\n\t\t".."The Results of your search:".."\r\n","","Data/"..os.date("%d%m%y")..".txt"
	
	if date then log="Data/"..date..".txt"	end

	found=found.."\t\t"..string.rep("??",12).."\r\n"
	if ip and verify(log) then
		for line in io.lines(log) do
			local s,e,search =string.find(line,ip)
			if not(e==nil) and not(s==nil) then 
				found=found.."\t"..line.."\r\n"
				check=line
				e=nil		--reset the searcher
				s=nil		-- ""		""
			end
		end
	elseif not ip then
		user:SendPM(BOTName,"Syntax Error. Correct Syntax is : !searchlog   eg.: !searchlog 127.0.0.1 060505")
	elseif not(verify(log)) then
		user:SendPM(BOTName,"There is no log to search in !!!")
	end
	if not(check=="") then
		user:SendPM(BOTName,found)
	else
		user:SendPM(BOTName,"That ip or nick wasnt found in the logs!!")
	end
end

function verify(filename)
local f = io.open(filename, "r")
	if f then
		f:close()
		return true
	end
end
Ignorance is Bliss.

Dinok

#4
Syntax ...PtokaX\scripts\Stat-Logger0.4a.lua:123: `=' expected near `=='

Dessamator

well, i just rechecked the script there isnt any syntax error, u must have edited something and caused that
copy the Script again, and/or Paste that line here !
Ignorance is Bliss.

SMF spam blocked by CleanTalk