i am running a private hub, and we don't want people to 1st share like 50 gb for a week, and then the next week share only 5 gb
We like to see a scripts so w can check a users share size from its last 10 logins ot whatever, last month
Is there a script that logs user sharesize when they login?
something like
{user}logged in at 4-4-04-20:11: sharesize 50.11gb
{user}logged in at 4-4-04-22:45: sharesize 53.11gb
{user}logged in at 5-4-04-21:11: sharesize 5.42gb
user}logged in at 6-4-04-21:11: sharesize 11.21gb
now, theres already this from the temp forum, but i am gettin no reactions there anymore:
BOT = "Share_Logger";
SHAREFILE = "share_log.txt";
TSHARE = {};
function DataArrival(user, data)
if strsub(data,1,1)=="<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="+s") then
s,e,name = strfind(data,"%b<>%s+%S+%s+(%S+)")
GetFromFile(SHAREFILE,TSHARE)
for ind,val in TSHARE do
local s,e,Name,Info = strfind(val,"(%S+)-(.*)")
if strlower(name) == strlower(Name) then
user:SendData(BOT,Info)
else
user:SendData(BOT,"That user has not been in this hub.") return 1
end
end
TSHARE = nil;
TSHARE = {};
return 1
end
end
if strsub(data,1,7)=="$MyINFO" then
local s,e,Share = strfind(data,"%$%s*(%d+)%$")
local curTIME = date()
Share = Share / 1024 / 1024 / 1024
Share = format("%0.2f",Share)
SaveToFile(SHAREFILE,user.sName,user.sIP.." Connected at "..curTIME..", Share : "..Share.." GB")
end
end
function SaveToFile(File,sUser,data)
local sFile = openfile(File,"a+")
write(sFile,sUser.."#"..data.."\n")
closefile(sFile)
end
function GetFromFile(File,IntoTable)
iCon = 0
readfrom(File)
while 1 do
local line = read()
if line == nil then
break
else
local _,_,Usr,Data = strfind(line,"(.*)%#(.*)")
rawset(IntoTable,iCon,Usr.."-"..Data)
iCon = iCon + 1
end
end
readfrom()
end
this seems to work, only the script only reads the 1 ruke in the generated txt file:
this is in the logfile now:
user1#154.5.xxx.xxx Connected at 04/20/04 18:02:49, Share : 5.87 GB
user2#206.116.xxx.xxx Connected at 04/20/04 18:03:27, Share : 15.63 GB
+s user1
user1#154.5.x.xx Connected at 04/20/04 18:02:49, Share : 5.87 GB
+s user2
That user has not been in this hub.
it is in the log, so he has been in the hub
i copied and pasted username, to be 100% sure
now there are 25 logs, but it only reads the 1st log it made, the rest it can't read or so
haven"t really played with the rawset function, but I don't think that it will actually insert the data from the file into the passed table more int ot he local table InfoTable of the function Get...()
so i just exchanged the tables
function GetFromFile(File,TSHARE)
iCon = 0
readfrom(File)
while 1 do
local line = read()
if line == nil then
break
else
local _,_,Usr,Data = strfind(line,"(.*)%#(.*)")
rawset(TSHARE,iCon,Usr.."-"..Data)
iCon = iCon + 1
end
end
readfrom()
end
else check out the script SL it does quite some more but else
it does what you want in a better way i must say
SL (http://board.univ-angers.fr/thread.php?threadid=1859&boardid=12&styleid=1&sid=cd750c92b0233a28298036ba5f044d1a)
result is the same, it only read the 1st entry in the log
ill try your other script
Sorry, will look into this matter as soon as possible