[req]scriptconversion statlogger
 

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

[req]scriptconversion statlogger

Started by sander815, 06 June, 2005, 14:24:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sander815


Markitos

#1
-- 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 os.date of that day when users math.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

-- Lua 5 version by Markitos (6/6/2005)


Grab it here(Not tested)

Best regards

jiten

Markitos, you also need to convert the file handling and Arrivals.
"DataArrival" should be changed to "ChatArrival" and the To: part becomes "ToArrival".

Cheers

Markitos

QuoteOriginally posted by jiten
Markitos, you also need to convert the file handling and Arrivals.
"DataArrival" should be changed to "ChatArrival" and the To: part becomes "ToArrival".

Cheers
Didn't understand dis part " and the To: part becomes "ToArrival". "
It's something like this "ToArrival = ChatArrival" can u you give me an example?

Respectfully...

Dessamator

#4
-- 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 = os.date("%d")
MM = os.date("%m")
Y = os.date("%y")


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

function Main() 
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+)") 
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/"..D..""..MM..""..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 
		io.close() 
	break 
		end 
		lines = lines..line.."\r\n" 
	end 
	user:SendPM(BOTName, lines) 
end


Done!
Ignorance is Bliss.

Dessamator

QuoteOriginally posted by Markitos
QuoteOriginally posted by jiten
Markitos, you also need to convert the file handling and Arrivals.
"DataArrival" should be changed to "ChatArrival" and the To: part becomes "ToArrival".

Cheers
Didn't understand dis part " and the To: part becomes "ToArrival". "
It's something like this "ToArrival = ChatArrival" can u you give me an example?

Respectfully...

hmm, he was talking about this :
 
if(strsub(data, 1, 4) == "$To:") then  
 

when u are converting to lua 5 u change that to this :

function ToArrival(user,data)

and this two parts of code u change from this :

function DataArrival(user,data) 
if( strsub(data, 1, 1) == "<" ) then  
end
 

to this :

function ChatArrival(user,data)
Ignorance is Bliss.

Penguin

Hi Dessamator,

Thank you very much for convert Troubadour's Stat-Logger into LUA5!!!

But I have one problem!
In the file for e.g.: 060605.txt -> I have only log of the newest user (who last logged on the hub)!
Older logs of users were enter on the hub didn't save into this file (The newer log rewrite older log) :(


    How's that?

   Thanks in adnvance for answer!

                  Penguin
P.S.
Sorry for my English!  :rolleyes:

Dessamator

QuoteOriginally posted by Penguin
Hi Dessamator,

Thank you very much for convert Troubadour's Stat-Logger into LUA5!!!

But I have one problem!
In the file for e.g.: 060605.txt -> I have only log of the newest user (who last logged on the hub)!
Older logs of users were enter on the hub didn't save into this file (The newer log rewrite older log) :(


    How's that?

   Thanks in adnvance for answer!

                  Penguin
P.S.
Sorry for my English!  :rolleyes:
Fixed !
Post edited !
Ignorance is Bliss.

sander815

#8
yes, thanx a lot for converting it, but as requested in the other thread, i would like this script to log on a per user base users details...

so i can do this:
+statlog [nick]
On the 06.06.05 - 16:28 - [nick] with e-mail nick@mail.com, IP 192.168.1.100 and with share 19.943974516355Gb connected
On the 07.06.05 - 16:28 - [nick] with e-mail nick@mail.com , IP 192.168.1.100 and with share 29.943974516355Gb connected
On the 07.06.05 - 22:21 - [nick] with e-mail nick@mail.com , IP 192.168.1.100 and with share 13.943974516355Gb connected

so i can log users activity

Dessamator

QuoteOriginally posted by sander815
yes, thanx a lot for converting it, but as requested in the other thread, i would like this script to log on a per user base users details...

so i can do this:
+statlog [nick]
On the 06.06.05 - 16:28 - [nick] with e-mail nick@mail.com, IP 192.168.1.100 and with share 19.943974516355Gb connected
On the 07.06.05 - 16:28 - [nick] with e-mail nick@mail.com , IP 192.168.1.100 and with share 29.943974516355Gb connected
On the 07.06.05 - 22:21 - [nick] with e-mail nick@mail.com , IP 192.168.1.100 and with share 13.943974516355Gb connected

so i can log users activity

no need to add that in this script, for starters a similar script already  exists, userinfo database by nightlitch, and others, theres iplog which does the same too, hope u understand :)
Ignorance is Bliss.

Penguin

QuoteOriginally posted by Dessamator
Fixed !
Post edited !

OK, Thank you very much Dessamator!!!

sander815

point me to them then, if possible

i have never found a script that does what i describe..

jiten

QuoteOriginally posted by sander815
point me to them then, if possible

i have never found a script that does what i describe..
As I pointed before, search for "Connection Log". It does that...

Cheers

Dessamator

Quote"userinfo" database by nightlitch, and others, theres "iplog" which does the same too,

click on the links in my signature and learn how to search my boy, search !
Ignorance is Bliss.

XPMAN

K, got a question.. does the Stat-logger 0.3 add a log for each day?.... if it does a way to keep the folder where the txt files are stored from getting huge would be nice. Maybe a clear command or del command to ..........time limit to self delete :) ..... just asking. I didnt see anyway of deleting the files except going into the scripts folder and manually doing it.

Dessamator

hmm,indeed thats a good point, but, how long should it stay there?
Ignorance is Bliss.

XPMAN

maybe be settable by the master\Op before auto delete or even yet at the very least have an option to say....... delete  050605-080205 :)  ..... a range. Just an idea.

Dessamator

hmm, indeed, ill see what i can do ! i think ill set it to a week on default :)
Ignorance is Bliss.

Dessamator

#18
--Lua 5 By Dessamator 
-- Stat-logger 0.3a
-- 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

D = os.date("%d")
MM = os.date("%m")
Y = os.date("%y")
a={}

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

function Main() 
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/"..D..""..MM..""..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/"..D..""..MM..""..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.

Penguin

QuoteOriginally posted by Dessamator
-- added !lastips(request by Penguin)

Hey Dessamator,
Thank you very much!!!

Dessamator

QuoteOriginally posted by Penguin
QuoteOriginally posted by Dessamator
-- added !lastips(request by Penguin)

Hey Dessamator,
Thank you very much!!!

no prob, btw i edited the script above, it might resolve ur prob(im unsure)
Ignorance is Bliss.

Penguin

QuoteOriginally posted by Dessamator
no prob, btw i edited the script above, it might resolve ur prob(im unsure)

OK -> THX
I test it.

Dessamator

Ignorance is Bliss.

XPMAN

Thanks for yet another awesome script :)

Well done!

jiten

QuoteOriginally posted by Dessamator
goody :)
m8, maybe it's better to post this one in the Finished Scripts section as it's a wanted one :D

Cheers

SMF spam blocked by CleanTalk