userinfo, seen and ip check for active user
 

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

userinfo, seen and ip check for active user

Started by dragos_sto, 23 June, 2005, 13:11:52

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dragos_sto

the English version  incoming soon

-- BotName -- 
BotName = frmHub:GetHubBotName().."_Info"
BotNameIp = frmHub:GetHubBotName().."_IpCheck"
HubBot = frmHub:GetHubBotName()
MaxSher = 1.5*1024*1024*1024*1024 --Tb
MailAdmin = "dragos@drtaberei.ro"
-- Prefix -- 
Prefix = "+" 

--Command-- 
cmd1 = "userinfo"
cmd2 = "seen" 
-- Tables -- 
Temp = {} 
Info = {}
seenArray={} 
-- Info Path -- 
InfoLog = "UserInfo/" -- Create this folder before starting the script

-- New User Connected -- 
function NewUserConnected(curUser,data) 
	LogInfo(curUser,0) 
end 

OpConnected = NewUserConnected

function UserDisconnected(curUser,data)
	LogInfo(curUser,1)
	local curuserlow = string.lower(curUser.sName)
	seenArray[curuserlow] = nil
end

OpDisconnected = UserDisconnected

function OnExit(curUser,data)
	LogInfo(curUser,1)
end
-- Search Arrival --
function SearchArrival(Usersearch, datasearch) 
	if datasearch ~= nil then
		local datalow = string.lower(datasearch)
		--string.find(data, "$Search%s+([^$]*):(.*))")
		local s,e,userIP,r = string.find(datalow, "$search%s+(%S+):(%S*)") 
		if userIP ~= "hub" and userIP ~= nil then
			if string.len(userIP) < 16 then
				if r ~= nil and r ~= 0 then 
					if userIP ~= Usersearch.sIP then 
						Usersearch:SendData(BotNameIp,userIP.."\r\n msg : "..Usersearch.sIP) 
						-- curUser:Disconnect()
					end
				end 
			end
		end
	end
end

-- Data Arrival -- 
function ChatArrival(curUser, data)
	local curuserlow = string.lower(curUser.sName)
	seenArray[curuserlow]=os.date(curUser.sName.." a fost ultima data vazut la %d/%m/%Y %T scriind pe aici.") 
	data = string.sub(data,1,string.len(data)-1) 
	if (GetCom(curUser,data) == 1) then 
		return 1 
	else 
		return 0 
	end 
end 

-- Get Command -- 
function GetCom(curUser,data) 
	local _,_,cmd = string.find(data,"^%b<>%s+%"..Prefix.."(%S+)") 
	if cmd then 
		if IPCommand[cmd] then 
			local Com = IPCommand[cmd](curUser,data) 
			return Com
		end 
	end 
end 

-- Commands -- 
IPCommand = { 
	[cmd1] = function(curUser,data) 
	if curUser.iProfile==0 then 
	local _,_,nick = string.find( data,"%b<>%s+%S+%s+(%S+)") 
	if (nick == nil or nick == "") then 
		curUser:SendData(BotName,"Syntax: "..Prefix..cmd1.." ") 
		return 1 
	end 
	local IP, Profile, MyInfo, Seen = GetInfo(nick) 
	if IP==0 and Profile==0 and MyInfo==0 then 
		curUser:SendData(BotName,"User not found in the logs.") 
		return 1 
	end 
		local _,_,Nick = string.find( MyInfo, "^%$MyINFO %$ALL (%S+)%s*") 
		local _,_,Speed,Share = string.find( MyInfo, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $([^$]+)[^$]%$[^$]*%$%s*(%d+)%$" ) 
		local _,_,Slots = string.find( MyInfo, "S:(%d+)") 
		local _,_,Client,Ver,Mode = string.find(MyInfo,"<(%S+),V:(%S+),M:([S,A,P,Nedeclarat])") 
		local_,_, Hubs,Hubsreg,Hubsop = string.find(MyInfo,"H:(%x+)/(%x+)/(%x+)") 		local line = "\r\n" 
		line = line .. "\r\n\t User Info on: "..Nick 
		line = line .. "\r\n\t --------------------------------------------------------------------" 
		line = line .. "\r\n\t --------------------------------------------------------------------" 
		line = line .. "\r\n\t IP: "..IP 
		line = line .. "\r\n\t Client: "..Client 
		line = line .. "\r\n\t Versiune: "..Ver 
		line = line .. "\r\n\t Mod de Conectare: "..Mode 
		line = line .. ("\r\n\t Haburi: "..Hubs.." Neinregistrat\t"..Hubsreg.." Inregistrat\t"..Hubsop.." Operator")
		line = line .. "\r\n\t Sloturi: "..Slots 
		line = line .. "\r\n\t Conexiune: "..Speed 
		line = line .. "\r\n\t Share: "..(string.format("%.2f",Share/1024/1024/1024).." GB")
		line = line .. "\r\n\t "..Seen 
		line = line .. "\r\n\t --------------------------------------------------------------------" 
		curUser:SendData(BotName,line)
		return 1 
	else return 0
	end
end,
	[cmd2] = function(curUserseen,dataseen) 
	local _,_,nick = string.find( dataseen,"%b<>%s+%S+%s+(%S+)") 
	if (nick == nil or nick == "") then 
		curUserseen:SendData(BotName,"Sintaxa Comenzi: "..Prefix..cmd2.." ") 
		return 1 
	end 
	local IP, Profile, MyInfo, Seen = GetInfo(nick) 
	if IP==0 and Profile==0 and MyInfo==0 then 
		curUserseen:SendData(BotName,"Nickul cautat nu a calcat pe aici")
		return 1
	end
	if IP == curUserseen.sIP then 
		curUserseen:SendData(BotName,"Nu stiam Ca esti Atat de Chior incat nu te vezi")
		return 1 
	end
	nick = string.lower(nick)
	if seenArray[nick] == nil or seenArray[nick]=="" then
		curUserseen:SendData(BotName,Seen)
		else 
		curUserseen:SendData(BotName,seenArray[nick])
	end
	return 1
	end
	,} 

-- Log Users Info -- 
function LogInfo(curUser,here)
	if string.len(curUser.sName) < 2 or string.len(curUser.sName) == nil then 
		curUser:SendData(HubBot,"\r\n\t nick too short ")
		curUser:Disconnect()
	end
	local Seen = nil
	if here == 0 then 
		Seen = os.date(curUser.sName.." s-a conectat la %d/%m/%Y %T si inca este aici")
		else Seen = os.date(curUser.sName.." s-a deconectat la %d/%m/%Y %T si nu a mai fost vazut de atunci")
	end
	Info[string.lower(curUser.sName)] = {["IP"]=curUser.sIP,["PROFILE"]=curUser.iProfile,["MYINFO"]=buildmyinfo(curUser),["SEEN"]=Seen,} 
	SaveToFile(InfoLog..string.lower(curUser.sName)..".dat" , Info , "Info") 
	Info = nil 
	Info = {} 
	collectgarbage() 
	io.flush()
	return 1 
end 

-- Get Info -- 
function GetInfo(nick) 
	LoadFromFile(InfoLog..string.lower(nick)..".dat") 
	local usr,IP,Profile,MyInfo,Seen = Info[string.lower(nick)],nil,nil,nil,nil
	if usr then 
		IP = usr["IP"] 
		Profile = usr["PROFILE"] 
		MyInfo = usr["MYINFO"]
		Seen = usr["SEEN"] 
		return IP,Profile, MyInfo,Seen
	else 
		return 0,0,0,0 
	end 
end 

-- Serialize -- 
function Serialize(tTable, sTableName, sTab) 
        assert(tTable, "tTable equals nil"); 
        assert(sTableName, "sTableName equals nil"); 
 
        assert(type(tTable) == "table", "tTable must be a table!"); 
        assert(type(sTableName) == "string", "sTableName must be a string!"); 
 
        sTab = sTab or ""; 
        local sTmp = "" 
 
        sTmp = sTmp..sTab..sTableName.." = {\n" 
 
        for key, value in tTable do 
                local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key); 
 
                if(type(value) == "table") then 
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t"); 
                else 
                        local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value); 
                        sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue 
                end 
 
                sTmp = sTmp..",\n" 
        end 
 
        sTmp = sTmp..sTab.."}" 
        return sTmp 
end 
 
function SaveToFile(file , table , tablename) 
	local handle = io.open(file,"w+") 
        handle:write(Serialize(table, tablename)) 
	handle:flush() 
        handle:close() 
end 

function LoadFromFile(file) 
	local handle = io.open(file,"r") 
	if (handle ~= nil) then 
		dofile(file)
		handle:flush() 
		handle:close()
        end 
end 

function buildmyinfo(curUser)
	local build,Tmp,useclien,usever,usemod,iohub,irhub,inhub = nil,nil,nil,nil,nil,nil,nil,nil
	build = "$MyINFO $ALL "
	build = build..curUser.sName
	if curUser.sDescription == nil then Tmp = "Nu_are_descriere" else Tmp = curUser.sDescription end
	build = build..(" "..Tmp)
	if curUser.sClient == nil then
		curUser:SendData(HubBot,"Clientul tau de dc nu-si declara Denumirea")
		useclien = "Necunoscut" 
		else 
		useclien = curUser.sClient
	end			
	if curUser.sClientVersion == nil then
		curUser:SendData(HubBot,"Clientul tau de dc nu-si declara Versiunea ")
		usever = "Necunoscuta" 
		else 
		usever = curUser.sClientVersion
	end
	build = build..("<"..useclien..",V:"..usever)
	if curUser.sMode == nil then 
		usemod = "Nedeclarat"
		curUser:SendData(HubBot,"Clientul tau de dc nu-si declara Modul de conectare esti tratat ca un user pasiv")
		else usemod = curUser.sMode 
	end 
	build = build..(",M:"..usemod)
	if curUser.iOpHubs == nil then 
		iohub = 0 
		else 
		iohub = curUser.iOpHubs 
	end
	if curUser.iRegHubs == nil then 
		irhub = 0 
		else 
		irhub = curUser.iRegHubs
	end
	if curUser.iNormalHubs == nil then 
		inhub = 0 
		else 
		inhub = curUser.iNormalHubs 
	end
	build = build..(",H:"..inhub.."/"..irhub.."/"..iohub)
	build = build..(",S:"..curUser.iSlots)
	build = build..(">$ $"..curUser.sConnection)
	build = build..("$"..curUser.sEmail)
	build = build..("$"..curUser.iShareSize.."$")
	-- check client tag
	local _,_,Client,Ver,Mode = string.find(build,"<(%S+),V:(%S+),M:([S,A,P,Nedeclarat])") 
	if Mode == "S" then 
		curUser:SendData(HubBot,"Conexiunile Socket nu sunt acceptate de server")
		curUser:Disconnect()
	end
	if Client == nil or Ver == nil or Mode == nil then 
		curUser:SendData(HubBot,"Problem Whit your client DC++ (for problems email too "..Mail Admin.." )")
		curUser:Disconnect()
	end
	if curUser.iShareSize > MaxSher then 
		curUser:SendData(HubBot,"Sher size too big , if not email to "..MailAdmin)
		curUser:Disconnect()
	end
	return build
end

NightLitch

I see some old code in your script that belongs to someone else...

Maybe you should start give credit for the functions and code you take from other scripts....

To many scripts forget that...
//NL

bastya_elvtars

QuoteOriginally posted by NightLitch
I see some old code in your script that belongs to someone else...

Maybe you should start give credit for the functions and code you take from other scripts....

To many scripts forget that...

Hey, at least he does not get a stript and replaces the 'written by plop' to his nick. On the other hand, I totally agree with you.
Everything could have been anything else and it would have just as much meaning.

dragos_sto

it dont write made by me ..
soo it a little from other script not just one
made by plop
i dont have  nothing contrary whit plop
i  appreciate his work

bastya_elvtars

QuoteOriginally posted by dragos_sto
made by plop
i dont have  nothing contrary whit plop
i  appreciate his work

That goes for another guy.
Everything could have been anything else and it would have just as much meaning.

NightLitch

well not to be a pain in the ass but this code:

-- Get Command -- 

function GetCom(curUser,data) 

	local _,_,cmd = string.find(data,"^%b<>%s+%"..Prefix.."(%S+)") 

	if cmd then 

		if IPCommand[cmd] then 

			local Com = IPCommand[cmd](curUser,data) 

			return Com

		end 

	end 

end 



-- Commands -- 

IPCommand = {

is right from one of my IP scripts...

and why do you hava command table with IP infront when no command have with IP to do...

If Am over the edge here somone please tell me...

Typhoon, Plop with others that have seen my code...

I know this is little to argue about but I have learned to give creds to everyone I take, get help from with code.

I don't know if Am having a bad day... but that is my code.
 :(
//NL

plop

QuoteOriginally posted by NightLitch is right from one of my IP scripts...

and why do you hava command table with IP infront when no command have with IP to do...

If Am over the edge here somone please tell me...

Typhoon, Plop with others that have seen my code...

I know this is little to argue about but I have learned to give creds to everyone I take, get help from with code.

I don't know if Am having a bad day... but that is my code.
 :(

yep we ask very little, if ppl use our code give us credits for it.
this is the main reason which is driving us.
and it isn't so hard 2 do, i even give credits 2 the ppl who help me debugging the scripts.
if you respect us scripters you do this little thing, if you don't then make everything yourself (i suggest ppl 2 do this last as you learn a lot more from it).

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

bastya_elvtars

Anyway this is not a big deal, just please keep an eye on it in the future. No offences at all.
Everything could have been anything else and it would have just as much meaning.

NightLitch

Yeah no big deal, I just farted so....


BTW, Am still stupid... now everyone that is not in plops hub knows  :D LooooooooooooooL
//NL

plop

QuoteOriginally posted by NightLitch
Yeah no big deal, I just farted so....


BTW, Am still stupid... now everyone that is not in plops hub knows  :D LooooooooooooooL

N.I.S.S.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

dragos_sto

#10
my opinion ,this forum it make to do something constructiv
when i take one script i modify for my need
soo i erase the top of the script
anyway hoo have the most post in constructiv way
it have all the credit  ,
and first of all to ppk for make new version of ptokax,
if this m8 not exist whil not exist the lua script whit soo much possibyliti

it soo important too see your name ...
it some people ho have they contribute , and it a little harder to say ho make first time one tipe of function or code

this it my opinion

dragos_sto

i founf i this forum the original script i use
Quote-- Simple Offline Info by NightLitch
-- Converted to Lua 5 by jiten
-- Commands is sent in Main-Chat
-- Create folder UserInfo
here

dragos_sto

it some difference bethwen them in my opinion

NightLitch

QuoteOriginally posted by dragos_sto
it some difference bethwen them in my opinion

Yes the puropose might be different, but you are still borrowing code from other scripts with functions made from other creators, they should get a simple quote in the script for helping you create your code.

QuoteOriginally posted by dragos_sto
it soo important too see your name ...
it some people ho have they contribute , and it a little harder to say ho make first time one tipe of function or code

would it be ok for me to take your code and say that it is totally me that have created it... My opinion NO!

I give credits to the ones I have borrowed code from.

I got a piece of code from plop the other day, it was not hard for me to understand nor to create it myself, but he gave me the code, I rewrote it for my needs, I still give plop credits in my script for the code he gave me.

its a little of give and take, but keep the names of creators,
This is what keeps us going.

Hell, I could stop posting codes. But then I know some sads faces if I left, *plop here's a tisue*

well, I don't much to say more.

*Use others code, but give credits or a line that code is taken from scripters code*

That is a codex that should be kept right ???

Peace out // the stuipid Litch
//NL

Snooze

As an example ... I would not know a thing about lua had it not been for the coders on this board.

Please respect their work.
Please respect their guidance.

In that, you show respect not only for the work already done, but also for the work to come.

Yours humbly,

Snooze

dragos_sto

i don say i not respect their work
just i say my opinion ...
just theat

dragos_sto

succes ... whit overwrite of description
-- BotName -- 
BotName = frmHub:GetHubBotName().."_Info"
BotNameIp = frmHub:GetHubBotName().."_IpCheck"
HubBot = frmHub:GetHubBotName()
MaxSher = 1.5*1024*1024*1024*1024 --Tb
MailAdmin = "dragos@drtaberei.ro"
-- Prefix -- 
Prefix = "+" 

--Command-- 
cmd1 = "userinfo"
cmd2 = "seen" 
TimeOverWrite = 60 -- time in second
-- Tables -- 
Temp = {} 
Info = {}
seenArray={}
-- range ip overwrite ="begin ip range-end ip range-description" 
-- not teste whit space in description
RangeDesc = {[1]="10.39.2.1-10.39.7.255-Mitnet_Ghencea", [2]="10.39.1.1-10.39.1.255-Dtnet",
		[3]="172.16.0.1-172.16.255.255-Crimenet", [4]="10.48.10.14-10.48.10.14-Sebastian_Net",
		[5]="10.48.15.1-10.48.15.255-Sebastian_net",[6]="10.48.8.1-10.48.10.13-Mitnet_DrTaberei",
		[7]="10.48.10.15-10.48.11.255-Mitnet_DrTaberei"}
 
-- Info Path -- 
InfoLog = "UserInfo/" -- Create this folder before starting the script

function Main()
	SetTimer(TimeOverWrite*1000) 
end
	
-- New User Connect Info Arrival
function MyINFOArrival(curUser,data)
if GetTimer() == nil then StartTimer() end
end

function OnTimer()
	local curUser = HubBot
	OverWrite(curUser)
	StopTimer()
end

function rebuilmyinfo(curUser)
	local descript,userip = nil,calcip(curUser.sIP)
	if userip ~= 0 then
			for index,descIP in RangeDesc do
				local _,_,startRange,endRange,RangeDescript = string.find(descIP, "(.*)-(.*)-(.*)")
				startRange = calcip(startRange)
				endRange = calcip(endRange)
				if userip>=startRange and userip<=endRange then
					descript = RangeDescript
				end
			end
		if descript == nil then descript = "Extern" end
		local _,_,nick,orgdescr,rest = string.find(curUser.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)<(.*)")
		SendToAll("$MyINFO $ALL "..nick.." "..descript.."<"..rest)
		end
end

function calcip(ipcalc)
	local _,_,a,b,c,d = string.find(ipcalc, "(%d+).(%d+).(%d+).(%d+)")
	local calc = 0
	if (tonumber(a) and tonumber(b) and tonumber(c) and tonumber(d)) then
		calc = a*16777216 + b*65536 + c*256 + d	
		return calc
		else return 0
	end
end

function OverWrite(curUser)
	local tableover = frmHub:GetOnlineUsers()
	for i, Userover in tableover do
		rebuilmyinfo(Userover)
	end
end
-- New User Connected -- 
function NewUserConnected(curUser,data)
	LogInfo(curUser,0)
end 

OpConnected = NewUserConnected

function UserDisconnected(curUser,data)
	LogInfo(curUser,1)
	local curuserlow = string.lower(curUser.sName)
	seenArray[curuserlow] = nil
end

OpDisconnected = UserDisconnected

function OnExit(curUser,data)
	LogInfo(curUser,1)
end
-- Search Arrival --
function SearchArrival(Usersearch, datasearch) 
	if datasearch ~= nil then
		local datalow = string.lower(datasearch)
		local s,e,userIP,r = string.find(datalow, "$search%s+(%S+):(%S*)") 
		if userIP ~= "hub" and userIP ~= nil then
			if string.len(userIP) < 16 then
				if r ~= nil and r ~= 0 then 
					if userIP ~= Usersearch.sIP then 
						Usersearch:SendData(BotNameIp,userIP.."\r\nEste foarte probabil ca ipul de la setarile tale de activ sa nu fie corect.\r\n daca nu stii la ce ma refer verifica in \r\n FILE --> SETTING --> ACTIV  \r\n Verifica daca ipul scris acolo corespunde cu cel care til returneaza hubul : \r\n de catre hub esti vazut cu ipul : "..Usersearch.sIP) 
					end
				end 
			end
		end
	end
end

-- Data Arrival -- 
function ChatArrival(curUser, data)
	local curuserlow = string.lower(curUser.sName)
	seenArray[curuserlow]=os.date(curUser.sName.." a fost ultima data vazut la %d/%m/%Y %T scriind pe aici.") 
	data = string.sub(data,1,string.len(data)-1) 
	if (GetCom(curUser,data) == 1) then 
		return 1 
	else 
		return 0 
	end 
end 

-- Get Command -- 
function GetCom(curUser,data) 
	local _,_,cmd = string.find(data,"^%b<>%s+%"..Prefix.."(%S+)") 
	if cmd then 
		if IPCommand[cmd] then 
			local Com = IPCommand[cmd](curUser,data) 
			return Com
		end 
	end 
end 

-- Commands -- 
IPCommand = { 
	[cmd1] = function(curUser,data) 
	if curUser.iProfile==0 then 
	local _,_,nick = string.find( data,"%b<>%s+%S+%s+(%S+)") 
	if (nick == nil or nick == "") then 
		curUser:SendData(BotName,"Syntax: "..Prefix..cmd1.." ") 
		return 1 
	end 
	local IP, Profile, MyInfo, Seen = GetInfo(nick) 
	if IP==0 and Profile==0 and MyInfo==0 then 
		curUser:SendData(BotName,"User not found in the logs.") 
		return 1 
	end 
		local _,_,Nick = string.find( MyInfo, "^%$MyINFO %$ALL (%S+)%s*") 
		local _,_,Speed,Share = string.find( MyInfo, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $([^$]+)[^$]%$[^$]*%$%s*(%d+)%$" ) 
		local _,_,Slots = string.find( MyInfo, "S:(%d+)") 
		local _,_,Client,Ver,Mode = string.find(MyInfo,"<(%S+),V:(%S+),M:([S,A,P,Nedeclarat])") 
		local_,_, Hubs,Hubsreg,Hubsop = string.find(MyInfo,"H:(%x+)/(%x+)/(%x+)") 		local line = "\r\n" 
		line = line .. "\r\n\t User Info on: "..Nick 
		line = line .. "\r\n\t --------------------------------------------------------------------" 
		line = line .. "\r\n\t --------------------------------------------------------------------" 
		line = line .. "\r\n\t IP: "..IP 
		line = line .. "\r\n\t Client: "..Client 
		line = line .. "\r\n\t Versiune: "..Ver 
		line = line .. "\r\n\t Mod de Conectare: "..Mode 
		line = line .. ("\r\n\t Haburi: "..Hubs.." Neinregistrat\t"..Hubsreg.." Inregistrat\t"..Hubsop.." Operator")
		line = line .. "\r\n\t Sloturi: "..Slots 
		line = line .. "\r\n\t Conexiune: "..Speed 
		line = line .. "\r\n\t Share: "..(string.format("%.2f",Share/1024/1024/1024).." GB")
		line = line .. "\r\n\t "..Seen 
		line = line .. "\r\n\t --------------------------------------------------------------------" 
		curUser:SendData(BotName,line)
		return 1 
	else return 0
	end
end,
	[cmd2] = function(curUserseen,dataseen) 
	local _,_,nick = string.find( dataseen,"%b<>%s+%S+%s+(%S+)") 
	if (nick == nil or nick == "") then 
		curUserseen:SendData(BotName,"Sintaxa Comenzi: "..Prefix..cmd2.." ") 
		return 1 
	end 
	local IP, Profile, MyInfo, Seen = GetInfo(nick) 
	if IP==0 and Profile==0 and MyInfo==0 then 
		curUserseen:SendData(BotName,"Nickul cautat nu a calcat pe aici")
		return 1
	end
	if IP == curUserseen.sIP then 
		curUserseen:SendData(BotName,"Nu stiam Ca esti Atat de Chior incat nu te vezi")
		return 1 
	end
	nick = string.lower(nick)
	if seenArray[nick] == nil or seenArray[nick]=="" then
		curUserseen:SendData(BotName,Seen)
		else 
		curUserseen:SendData(BotName,seenArray[nick])
	end
	return 1
	end
	,} 

-- Log Users Info -- 
function LogInfo(curUser,here)
	local Seen = nil
	if here == 0 then 
		if string.len(curUser.sName) < 2 or string.len(curUser.sName) == nil then 
			curUser:SendData(HubBot,"\r\n\t Nu crezi ca ai un nick cam mic ?\r\n\t scrie si tu ceva la nick\r\n\t Daca nu te descurci viziteaza [URL]http://10.48.8.252[/URL])")
			curUser:Disconnect()
		end
		Seen = os.date(curUser.sName.." s-a conectat la %d/%m/%Y %T si inca este aici")
		else Seen = os.date(curUser.sName.." s-a deconectat la %d/%m/%Y %T si nu a mai fost vazut de atunci")
	end
	Info[string.lower(curUser.sName)] = {["IP"]=curUser.sIP,["PROFILE"]=curUser.iProfile,["MYINFO"]=buildmyinfo(curUser),["SEEN"]=Seen,} 
	SaveToFile(InfoLog..string.lower(curUser.sName)..".dat" , Info , "Info") 
	Info = nil 
	Info = {} 
	collectgarbage() 
	io.flush()
	local userlow = string.lower(curUser.sName)
	if (string.find(userlow,"[ro]",1,4)) then
		curUser:SendData(HubBot,"Fara [RO] in Nickul tau,\r\n\tCa sa schimbi nickul tau pe acest hub \r\n\t scrie in main /fav da un enter \r\n\t dupa care te duci la Favorite Hubs (sau dai CTRL + F)\r\n\tdai click pe hubul Shantz (nu prea in dreapta,acolo unde poti bifa daca sa se logheze automat la hub sau nu cum deschizi odc)\r\n\tsi dai properties unde in casutele de sub Identification la\r\n\tnick scrii nickul dorit fara [RO][B][ISP]\r\n\tsi la password scrii parola daca ti-ai inregistart nickul\r\n\r\n\t Daca nu te descurci viziteaza [URL]http://10.48.8.252[/URL])")
		curUser:Disconnect()
	end
	return 1 
end 

-- Get Info -- 
function GetInfo(nick) 
	LoadFromFile(InfoLog..string.lower(nick)..".dat") 
	local usr,IP,Profile,MyInfo,Seen = Info[string.lower(nick)],nil,nil,nil,nil
	if usr then 
		IP = usr["IP"] 
		Profile = usr["PROFILE"] 
		MyInfo = usr["MYINFO"]
		Seen = usr["SEEN"] 
		return IP,Profile, MyInfo,Seen
	else 
		return 0,0,0,0 
	end 
end 

-- Serialize -- 
function Serialize(tTable, sTableName, sTab) 
        assert(tTable, "tTable equals nil"); 
        assert(sTableName, "sTableName equals nil"); 
 
        assert(type(tTable) == "table", "tTable must be a table!"); 
        assert(type(sTableName) == "string", "sTableName must be a string!"); 
 
        sTab = sTab or ""; 
        local sTmp = "" 
 
        sTmp = sTmp..sTab..sTableName.." = {\n" 
 
        for key, value in tTable do 
                local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key); 
 
                if(type(value) == "table") then 
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t"); 
                else 
                        local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value); 
                        sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue 
                end 
 
                sTmp = sTmp..",\n" 
        end 
 
        sTmp = sTmp..sTab.."}" 
        return sTmp 
end 
 
function SaveToFile(file , table , tablename) 
	local handle = io.open(file,"w+") 
        handle:write(Serialize(table, tablename)) 
	handle:flush() 
        handle:close() 
end 

function LoadFromFile(file) 
	local handle = io.open(file,"r") 
	if (handle ~= nil) then 
		dofile(file)
		handle:flush() 
		handle:close()
        end 
end 

function buildmyinfo(curUser)
	local build,Tmp,useclien,usever,usemod,iohub,irhub,inhub = nil,nil,nil,nil,nil,nil,nil,nil
	build = "$MyINFO $ALL "
	build = build..curUser.sName
	if curUser.sDescription == nil then Tmp = "Nu_are_descriere" else Tmp = curUser.sDescription end
	build = build..(" "..Tmp)
	if curUser.sClient == nil then
		curUser:SendData(HubBot,"Clientul tau de dc nu-si declara Denumirea")
		useclien = "Necunoscut" 
		else 
		useclien = curUser.sClient
	end			
	if curUser.sClientVersion == nil then
		curUser:SendData(HubBot,"Clientul tau de dc nu-si declara Versiunea ")
		usever = "Necunoscuta" 
		else 
		usever = curUser.sClientVersion
	end
	build = build..("<"..useclien..",V:"..usever)
	if curUser.sMode == nil then 
		usemod = "Nedeclarat"
		curUser:SendData(HubBot,"Clientul tau de dc nu-si declara Modul de conectare esti tratat ca un user pasiv")
		else usemod = curUser.sMode 
	end 
	build = build..(",M:"..usemod)
	if curUser.iOpHubs == nil then 
		iohub = 0 
		else 
		iohub = curUser.iOpHubs 
	end
	if curUser.iRegHubs == nil then 
		irhub = 0 
		else 
		irhub = curUser.iRegHubs
	end
	if curUser.iNormalHubs == nil then 
		inhub = 0 
		else 
		inhub = curUser.iNormalHubs 
	end
	build = build..(",H:"..inhub.."/"..irhub.."/"..iohub)
	build = build..(",S:"..curUser.iSlots)
	build = build..(">$ $"..curUser.sConnection)
	build = build..("$"..curUser.sEmail)
	build = build..("$"..curUser.iShareSize.."$")
	-- check client tag
	local _,_,Client,Ver,Mode = string.find(build,"<(%S+),V:(%S+),M:([S,A,P,Nedeclarat])") 
	if Mode == "S" then 
		curUser:SendData(HubBot,"Conexiunile Socket nu sunt acceptate de server")
		curUser:Disconnect()
	end
	if Client == nil or Ver == nil or Mode == nil then 
		curUser:SendData(HubBot,"Clientul tau de dc nu este suportat de server,foloseste un client standard sau configureaza clientul tau sa emuleze un client standard de DC++ (pt probleme email la "..MailAdmin.." )")
		curUser:Disconnect()
	end
	if curUser.iShareSize > MaxSher then 
		curUser:SendData(HubBot,"Nu crezi ca ai sherul cam mare ?Esti suspectat de Sher Fake,daca nu este asa Da un email la "..MailAdmin)
		curUser:Disconnect()
	end
	return build
end


sorry for brut script and for my language ..
i will try to make the english version ..

dragos_sto

one improvment to consume less bandwhit
-- BotName -- 
BotName = frmHub:GetHubBotName().."_Info"
BotNameIp = frmHub:GetHubBotName().."_IpCheck"
HubBot = frmHub:GetHubBotName()
MaxSher = 1.5*1024*1024*1024*1024 --Tb
MailAdmin = "dragos@drtaberei.ro"
-- Prefix -- 
Prefix = "+" 

--Command-- 
cmd1 = "userinfo"
cmd2 = "seen" 
TimeOverWrite = 60 -- time in second
-- Tables -- 
Temp = {} 
Info = {}
seenArray={}
InfoOver={}
-- range ip overwrite ="begin ip range-end ip range-description" 
-- not teste whit space in description
RangeDesc = {[1]="10.39.2.1-10.39.7.255-Mitnet_Ghencea", [2]="10.39.1.1-10.39.1.255-Dtnet",
		[3]="172.16.0.1-172.16.255.255-Crimenet", [4]="10.48.10.14-10.48.10.14-Sebastian_Net",
		[5]="10.48.15.1-10.48.15.255-Sebastian_net",[6]="10.48.8.1-10.48.10.13-Mitnet_DrTaberei",
		[7]="10.48.10.15-10.48.11.255-Mitnet_DrTaberei"}
 
-- Info Path -- 
InfoLog = "UserInfo/" -- Create this folder before starting the script

function Main()
	SetTimer(TimeOverWrite*1000) 
end
	
-- New User Connect Info Arrival
function MyINFOArrival(curUser,data)
	InfoOver[curUser.sName] = 1
	if GetTimer() == nil then StartTimer() end
end

function OnTimer()
	OverWrite(HubBot)
	StopTimer()
end

function rebuilmyinfo(InfoUser,DestUser,wherto)
	local descript,userip = nil,calcip(InfoUser.sIP)
	if userip ~= 0 then
			for index,descIP in RangeDesc do
				local _,_,startRange,endRange,RangeDescript = string.find(descIP, "(.*)-(.*)-(.*)")
				startRange = calcip(startRange)
				endRange = calcip(endRange)
				if userip>=startRange and userip<=endRange then
					descript = RangeDescript
				end
			end
		if descript == nil then descript = "Extern" end
		local _,_,nick,orgdescr,rest = string.find(InfoUser.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)<(.*)")
		if wherto == 1 then 
			SendToAll("$MyINFO $ALL "..nick.." "..descript.."<"..rest)
			else 
			SendToNick(DestUser.sName,"$MyINFO $ALL "..nick.." "..descript.."<"..rest)
		end
	end
end

function calcip(ipcalc)
	local _,_,a,b,c,d = string.find(ipcalc, "(%d+).(%d+).(%d+).(%d+)")
	local calc = 0
	if (tonumber(a) and tonumber(b) and tonumber(c) and tonumber(d)) then
		calc = a*16777216 + b*65536 + c*256 + d	
		return calc
		else return 0
	end
end

function OverWrite(curUser)
	local table2over,tableover = frmHub:GetOnlineUsers(),frmHub:GetOnlineUsers()
	for i, Userover in tableover do
		if InfoOver[Userover.sName] == 1 then 
			rebuilmyinfo(Userover,HubBot,1)
			for j, User2over in table2over do
				rebuilmyinfo(User2over,Userover,0)
			end
		end
		InfoOver[Userover] = nil
	end
	table2over,tableover = nil,nil
end
-- New User Connected -- 
function NewUserConnected(curUser,data)
	LogInfo(curUser,0)
end 

OpConnected = NewUserConnected

function UserDisconnected(curUser,data)
	InfoOver[curUser] = nil
	LogInfo(curUser,1)
	local curuserlow = string.lower(curUser.sName)
	seenArray[curuserlow] = nil
end

OpDisconnected = UserDisconnected

function OnExit(curUser,data)
	LogInfo(curUser,1)
end
-- Search Arrival --
function SearchArrival(Usersearch, datasearch) 
	if datasearch ~= nil then
		local datalow = string.lower(datasearch)
		local s,e,userIP,r = string.find(datalow, "$search%s+(%S+):(%S*)") 
		if userIP ~= "hub" and userIP ~= nil then
			if string.len(userIP) < 16 then
				if r ~= nil and r ~= 0 then 
					if userIP ~= Usersearch.sIP then 
						Usersearch:SendData(BotNameIp,userIP.."\r\nEste foarte probabil ca ipul de la setarile tale de activ sa nu fie corect.\r\n daca nu stii la ce ma refer verifica in \r\n FILE --> SETTING --> ACTIV  \r\n Verifica daca ipul scris acolo corespunde cu cel care til returneaza hubul : \r\n de catre hub esti vazut cu ipul : "..Usersearch.sIP) 
					end
				end 
			end
		end
	end
end

-- Data Arrival -- 
function ChatArrival(curUser, data)
	local curuserlow = string.lower(curUser.sName)
	seenArray[curuserlow]=os.date(curUser.sName.." a fost ultima data vazut la %d/%m/%Y %T scriind pe aici.") 
	data = string.sub(data,1,string.len(data)-1) 
	if (GetCom(curUser,data) == 1) then 
		return 1 
	else 
		return 0 
	end 
end 

-- Get Command -- 
function GetCom(curUser,data) 
	local _,_,cmd = string.find(data,"^%b<>%s+%"..Prefix.."(%S+)") 
	if cmd then 
		if IPCommand[cmd] then 
			local Com = IPCommand[cmd](curUser,data) 
			return Com
		end 
	end 
end 

-- Commands -- 
IPCommand = { 
	[cmd1] = function(curUser,data) 
	if curUser.iProfile==0 then 
	local _,_,nick = string.find( data,"%b<>%s+%S+%s+(%S+)") 
	if (nick == nil or nick == "") then 
		curUser:SendData(BotName,"Syntax: "..Prefix..cmd1.." ") 
		return 1 
	end 
	local IP, Profile, MyInfo, Seen = GetInfo(nick) 
	if IP==0 and Profile==0 and MyInfo==0 then 
		curUser:SendData(BotName,"User not found in the logs.") 
		return 1 
	end 
		local _,_,Nick = string.find( MyInfo, "^%$MyINFO %$ALL (%S+)%s*") 
		local _,_,Speed,Share = string.find( MyInfo, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $([^$]+)[^$]%$[^$]*%$%s*(%d+)%$" ) 
		local _,_,Slots = string.find( MyInfo, "S:(%d+)") 
		local _,_,Client,Ver,Mode = string.find(MyInfo,"<(%S+),V:(%S+),M:([S,A,P,Nedeclarat])") 
		local_,_, Hubs,Hubsreg,Hubsop = string.find(MyInfo,"H:(%x+)/(%x+)/(%x+)") 		local line = "\r\n" 
		line = line .. "\r\n\t User Info on: "..Nick 
		line = line .. "\r\n\t --------------------------------------------------------------------" 
		line = line .. "\r\n\t --------------------------------------------------------------------" 
		line = line .. "\r\n\t IP: "..IP 
		line = line .. "\r\n\t Client: "..Client 
		line = line .. "\r\n\t Versiune: "..Ver 
		line = line .. "\r\n\t Mod de Conectare: "..Mode 
		line = line .. ("\r\n\t Haburi: "..Hubs.." Neinregistrat\t"..Hubsreg.." Inregistrat\t"..Hubsop.." Operator")
		line = line .. "\r\n\t Sloturi: "..Slots 
		line = line .. "\r\n\t Conexiune: "..Speed 
		line = line .. "\r\n\t Share: "..(string.format("%.2f",Share/1024/1024/1024).." GB")
		line = line .. "\r\n\t "..Seen 
		line = line .. "\r\n\t --------------------------------------------------------------------" 
		curUser:SendData(BotName,line)
		return 1 
	else return 0
	end
end,
	[cmd2] = function(curUserseen,dataseen) 
	local _,_,nick = string.find( dataseen,"%b<>%s+%S+%s+(%S+)") 
	if (nick == nil or nick == "") then 
		curUserseen:SendData(BotName,"Sintaxa Comenzi: "..Prefix..cmd2.." ") 
		return 1 
	end 
	local IP, Profile, MyInfo, Seen = GetInfo(nick) 
	if IP==0 and Profile==0 and MyInfo==0 then 
		curUserseen:SendData(BotName,"Nickul cautat nu a calcat pe aici")
		return 1
	end
	if IP == curUserseen.sIP then 
		curUserseen:SendData(BotName,"Nu stiam Ca esti Atat de Chior incat nu te vezi")
		return 1 
	end
	nick = string.lower(nick)
	if seenArray[nick] == nil or seenArray[nick]=="" then
		curUserseen:SendData(BotName,Seen)
		else 
		curUserseen:SendData(BotName,seenArray[nick])
	end
	return 1
	end
	,} 

-- Log Users Info -- 
function LogInfo(curUser,here)
	local Seen = nil
	if here == 0 then 
		if string.len(curUser.sName) < 2 or string.len(curUser.sName) == nil then 
			curUser:SendData(HubBot,"\r\n\t Nu crezi ca ai un nick cam mic ?\r\n\t scrie si tu ceva la nick\r\n\t Daca nu te descurci viziteaza [URL]http://10.48.8.252[/URL])")
			curUser:Disconnect()
		end
		Seen = os.date(curUser.sName.." s-a conectat la %d/%m/%Y %T si inca este aici")
		else Seen = os.date(curUser.sName.." s-a deconectat la %d/%m/%Y %T si nu a mai fost vazut de atunci")
	end
	Info[string.lower(curUser.sName)] = {["IP"]=curUser.sIP,["PROFILE"]=curUser.iProfile,["MYINFO"]=buildmyinfo(curUser),["SEEN"]=Seen,} 
	SaveToFile(InfoLog..string.lower(curUser.sName)..".dat" , Info , "Info") 
	Info = nil 
	Info = {} 
	collectgarbage() 
	io.flush()
	local userlow = string.lower(curUser.sName)
	if (string.find(userlow,"[ro]",1,4)) then
		curUser:SendData(HubBot,"Fara [RO] in Nickul tau,\r\n\tCa sa schimbi nickul tau pe acest hub \r\n\t scrie in main /fav da un enter \r\n\t dupa care te duci la Favorite Hubs (sau dai CTRL + F)\r\n\tdai click pe hubul Shantz (nu prea in dreapta,acolo unde poti bifa daca sa se logheze automat la hub sau nu cum deschizi odc)\r\n\tsi dai properties unde in casutele de sub Identification la\r\n\tnick scrii nickul dorit fara [RO][B][ISP]\r\n\tsi la password scrii parola daca ti-ai inregistart nickul\r\n\r\n\t Daca nu te descurci viziteaza [URL]http://10.48.8.252[/URL])")
		curUser:Disconnect()
	end
	return 1 
end 

-- Get Info -- 
function GetInfo(nick) 
	LoadFromFile(InfoLog..string.lower(nick)..".dat") 
	local usr,IP,Profile,MyInfo,Seen = Info[string.lower(nick)],nil,nil,nil,nil
	if usr then 
		IP = usr["IP"] 
		Profile = usr["PROFILE"] 
		MyInfo = usr["MYINFO"]
		Seen = usr["SEEN"] 
		return IP,Profile, MyInfo,Seen
	else 
		return 0,0,0,0 
	end 
end 

-- Serialize -- 
function Serialize(tTable, sTableName, sTab) 
        assert(tTable, "tTable equals nil"); 
        assert(sTableName, "sTableName equals nil"); 
 
        assert(type(tTable) == "table", "tTable must be a table!"); 
        assert(type(sTableName) == "string", "sTableName must be a string!"); 
 
        sTab = sTab or ""; 
        local sTmp = "" 
 
        sTmp = sTmp..sTab..sTableName.." = {\n" 
 
        for key, value in tTable do 
                local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key); 
 
                if(type(value) == "table") then 
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t"); 
                else 
                        local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value); 
                        sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue 
                end 
 
                sTmp = sTmp..",\n" 
        end 
 
        sTmp = sTmp..sTab.."}" 
        return sTmp 
end 
 
function SaveToFile(file , table , tablename) 
	local handle = io.open(file,"w+") 
        handle:write(Serialize(table, tablename)) 
	handle:flush() 
        handle:close() 
end 

function LoadFromFile(file) 
	local handle = io.open(file,"r") 
	if (handle ~= nil) then 
		dofile(file)
		handle:flush() 
		handle:close()
        end 
end 

function buildmyinfo(curUser)
	local build,Tmp,useclien,usever,usemod,iohub,irhub,inhub = nil,nil,nil,nil,nil,nil,nil,nil
	build = "$MyINFO $ALL "
	build = build..curUser.sName
	if curUser.sDescription == nil then Tmp = "Nu_are_descriere" else Tmp = curUser.sDescription end
	build = build..(" "..Tmp)
	if curUser.sClient == nil then
		curUser:SendData(HubBot,"Clientul tau de dc nu-si declara Denumirea")
		useclien = "Necunoscut" 
		else 
		useclien = curUser.sClient
	end			
	if curUser.sClientVersion == nil then
		curUser:SendData(HubBot,"Clientul tau de dc nu-si declara Versiunea ")
		usever = "Necunoscuta" 
		else 
		usever = curUser.sClientVersion
	end
	build = build..("<"..useclien..",V:"..usever)
	if curUser.sMode == nil then 
		usemod = "Nedeclarat"
		curUser:SendData(HubBot,"Clientul tau de dc nu-si declara Modul de conectare esti tratat ca un user pasiv")
		else usemod = curUser.sMode 
	end 
	build = build..(",M:"..usemod)
	if curUser.iOpHubs == nil then 
		iohub = 0 
		else 
		iohub = curUser.iOpHubs 
	end
	if curUser.iRegHubs == nil then 
		irhub = 0 
		else 
		irhub = curUser.iRegHubs
	end
	if curUser.iNormalHubs == nil then 
		inhub = 0 
		else 
		inhub = curUser.iNormalHubs 
	end
	build = build..(",H:"..inhub.."/"..irhub.."/"..iohub)
	build = build..(",S:"..curUser.iSlots)
	build = build..(">$ $"..curUser.sConnection)
	build = build..("$"..curUser.sEmail)
	build = build..("$"..curUser.iShareSize.."$")
	-- check client tag
	local _,_,Client,Ver,Mode = string.find(build,"<(%S+),V:(%S+),M:([S,A,P,Nedeclarat])") 
	if Client == nil or Ver == nil or Mode == nil then 
		curUser:SendData(HubBot,"Contact hub Administrator"..MailAdmin.." )")
		curUser:Disconnect()
	end
	if curUser.iShareSize > MaxSher then 
		curUser:SendData(HubBot,"too mutch sher "..MailAdmin)
		curUser:Disconnect()
	end
	return build
end

i go to sleeeeep

Ubikk

Nice script, Dragos. I'm from Romania also  :D
Btw, you should work on those english skills more often  :rolleyes:

plop

QuoteOriginally posted by dragos_sto
i don say i not respect their work
just i say my opinion ...
just theat

not only say that you respect us, also show it.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk