login problem :)
 

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

login problem :)

Started by Typhoon, 09 July, 2004, 00:55:40

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Typhoon

hey again guys i am trying to make this work with an allowed tags table, but i am screwing it up or am being to tired atm. someone please show or hint me or help me fix it :) thx in advance...

RedirectOnFailed = 1	-- nil or 1 to redirect when user fails to meet the Log-In Check criteria (not for Forbiddenwords)
useTempBan = nil		-- nil or 1 to TempBan users when they don't meet the criteria.

allowed = {
["++"]=1,
["oDC"]=1,
["DCGUI"]=1
}


--// This function is fired when a new user finishes the login 

function CheckMyInfo( user, myinfo )
	if RedirectOnFailed then
		user.FailedLogin = function( o )
			local addr = frmHub:GetRedirectAddress()
			local warning = gsub( GU11.." [H]", "%[H%]", addr, 1 )
			WarnMess = gsub( GU12.." {[H]} "..OP3 , "%[H%]", addr, 1 )
			o:SendPM( BotNameName, warning )
			o:SendData( "$ForceMove "..addr )
				if useTempBan then
				o:TempBan()
				else
				o:Disconnect()
				end
		end
	else
		if useTempBan then
		user.FailedLogin = user.TempBan
		WarnMess = GU9
		else
		user.FailedLogin = user.Disconnect
		WarnMess = GU10
		end
	end
	--// get needed info from string
	if allowed[T] then
	local ret,c,T,V,M,H,S,O,speed,share = strfind( myinfo,
		--     V:0123	 M:P|A H:0-99    S:0-99    O:0-99	   speed         share
		"<([^<> ]+) V:([^,]+),M:(.),H:([^,]+),S:([^,]+),O:([^,>]+).*>$ $([^$]*)%$[^$]*%$(%d+)%$$" )	-- dc++, with O
	if not ret then
		ret,c,T,V,M,H,S,speed,share = strfind( myinfo,
		--     V:0123	 M:P|A H:0-99    S:0-99		  speed	       share
		"<([^<> ]+) V:([^,]+),M:(.),H:([^,]+),S:([^,>]+).*>$ $([^$]*)%$[^$]*%$(%d+)%$$" )	-- dc++, without O
	end
	if not ret then
		ret,c,share = strfind( myinfo,
		-- share
		"%$(%d+)%$$" )	-- nmdc/other, non <++ V:
	end
	if not ret then
		user:SendPM( BotNameName, GU7 )
		user:FailedLogin()
		SendToFollow("<"..user.sName.."> "..WarnMess.." "..GU8)
		return
	end
	--// fix new DC024 H:x/y/z notation
	if H then
		local Hn = {0}	-- crappy-ass lua4 workaround
		gsub( H, "(%d+)", function( x ) %Hn[1] = %Hn[1] + tonumber( x ) end, hubCheckMethod )
		H = Hn[1]
	end
	--// fix slots while we're at it, no need for multiple tonumber()'s
	if S then
		S = tonumber( S )
	end
	local userShare = tonumber(share) 
	local minShare = tonumber(frmHub:GetMinShare()*1024*1024)
	local minShareGB = (frmHub:GetMinShare()/1024)
	local userShareGB = format("%0.2f", tonumber(share)/1024/1024/1024) 
	--// check for NMDC / Version / Share / MaxSlots / MaxHubs / MinSlots / MinSlotsPrHub
	 if not allowed[T] then
		user:SendPM( BotName, GU1)
		user:FailedLogin()
		SendToFollow("<"..user.sName.."> "..WarnMess.." "..GU2)
		return
	elseif allowed[T] and minVersion then
		local n = tonumber( V )
		if not n then 
			SendPmToOps( BotName,GU3.." V:"..V.." "..GU4.." <"..user.sName.."> -- "..GU5 )
		elseif n < minVersion then
			local warning = gsub( GU6.." [V]", "%[V%]", tostring( minVersion ), 1 )
			user:SendPM( BotName, warning )
			user:FailedLogin()
			SendToFollow("<"..user.sName.."> "..WarnMess.." "..GU13.." ["..n.."] - { "..GU14.." ["..minVersion.."] }")
			return
		end
	elseif userShare < minShare then
		user:SendPM(BotName, GU15.." "..minShareGB.." GB. "..GU16.." ("..userShareGB..") GB")
		user:FailedLogin()
		SendToFollow("<"..user.sName.."> "..WarnMess.." ("..userShareGB..") GB "..GU17.." - { "..GU18.." ("..minShareGB..") GB "..GU17..". }")
		return
	elseif H and S then
		if maxSlots and S > maxSlots then
		user:SendPM(BotName, GU19.." ("..maxSlots..") "..GU16.." ("..S..") "..GU20)
		user:FailedLogin()
		SendToFollow("<"..user.sName.."> "..WarnMess.." ("..S..") "..GU21.." - { Maximum ("..maxSlots..") "..GU20..". }")
		return
		elseif maxHubs and H > maxHubs then
		user:SendPM(BotName, GU22.." ["..maxHubs.."] "..GU23.." ["..H.."] "..GU24)
		user:FailedLogin()
		SendToFollow("<"..user.sName.."> "..WarnMess.." ("..H..") "..GU25.." - { Maximum ["..maxHubs.."] "..GU24..". }")
		return
		elseif minSlotsPerHub and S < ( H * minSlotsPerHub )+ExtraSlots then
		user:SendPM(BotName, GU26.." ("..(minSlotsPerHub*H)+ExtraSlots.."/"..H..") "..GU16.." ("..S.."/"..H..") "..GU27)
		user:FailedLogin()
		SendToFollow("<"..user.sName.."> "..WarnMess.." ("..S.."/"..H..") "..GU27.."  - { "..GU18.." ("..(minSlotsPerHub*H)+ExtraSlots.."/"..H..") "..GU27..". }")
		return
		elseif minSlots and S < minSlots then
		user:SendPM(BotName, GU28.." ("..minSlots..") "..GU16.." ("..S..") "..GU29)
		user:FailedLogin()
		SendToFollow("<"..user.sName.."> "..WarnMess.." ("..S..") "..GU21.."! - { "..GU18.." ("..minSlots..") "..GU29..". }")
		return
		end
	end
	--// Connection Speed vs Slots.
	if speed and SlotsVsSpeedCheck then
	local speed = strsub(speed,1,strlen(speed)-1)
		if SlotsVsSpeed[speed] and S > SlotsVsSpeed[speed] then
		user:SendPM(BotName, GU30.." ("..SlotsVsSpeed[speed]..") "..GU16.." ("..S..") "..GU29)
		user:FailedLogin()
		SendToFollow("<"..user.sName.."> "..WarnMess.." ["..speed.."] "..OP22.." ("..S..") "..GU29.."! - { "..GU31.." ("..SlotsVsSpeed[speed]..") "..GU29..". }")
		end
	end
end
end

-Typhoon?



Typhoon

above post updated sorry for the miss :)



Typhoon

well , i have the check in dataarrival with a level select, so certain levels like ops dont get checked..
and the problem of mine is the table part i tryed to play with it but no luck at all.. , and i really think a update of the function are about time

* Typhoon?



SMF spam blocked by CleanTalk