Block passive unregistered users
 

Block passive unregistered users

Started by Scanning, 10 April, 2010, 19:08:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Scanning

Hello there :)

I need a script that blocks passive unregistered users from search ( just search ) download i don't care about :), to save bandwidh, like http://forum.ptokax.org/index.php?topic=6779.0
But even if i try to convert that one, it works for some minutes and then i get errors
Or if someone has any other suggestions, i would love to get some tips

thanks in advance

bastya_elvtars

What errors do you get exactly? Could you please post the converted code as well?
Everything could have been anything else and it would have just as much meaning.

Scanning

--Block passive search for unregistered users, made by Mutor
sBot = "SomeHubsBot"
sFeedNick = "Owner"
SearchArrival = function (user, data)
	if not RegMan.GetReg(user.sNick) and not user.bActive then
		local s,e,search = string.find(data,"([^%?]+)|$")

			local res = "Unknown Path"..string.char(92)..user.sNick..", search is disabled for you :P Only active users can search, type +active (Or register yourself)"..string.rep(" ",350)..search

			Core.SendToNick(user.sNick,"$SR "..SetMan.GetString(21).." "..res.." 0 0/0"..

			SetMan.GetString(0).." ("..Core.GetHubIP()..":"..SetMan.GetString(4)..")")
	Core.SendPmToNick(sFeedNick, sBot, user.sNick.. " with ip " ..user.sIP.. " is trying to search in passive mode ")

		return true

	end

end


and the error is attemt to concatenate local search  a nil value

bastya_elvtars

Oh yeah, you just have to replace string.find to string.match.
Everything could have been anything else and it would have just as much meaning.

Scanning

Well, i must be lost in space, but still same error in line:
local res = "Unknown Path"..string.char(92)..user.sNick..", search is disabled for you :P Only active users can search, type +active (Or register yourself)"..string.rep(" ",350)..search

Scanning

Trying that one right now, thanks bastya_elvtars and Mutor

Scanning

#6
It looks like it's affecting active users to thou, they starting to register.

and if i search in passive mode and then switch to active, i get the blocked message, but when i register, it goes away.
But i'm going to test it more

It affects active users to, any suggestions ?

Scanning

Nah, it's still affects active users to, switched to Mutors regme for now and reg for search and download

dunno what's wrong

bastya_elvtars

A fix for you.

--[[
	Passive search block, by Mutor
	Blocks search for unregistered passive users
	Returns fraudulent search result.
]]

OnStartup = function()
	h,b,i,u = SetMan.GetString(0),SetMan.GetString(21),SetMan.GetString(3):gsub(";.*",""),SetMan.GetString(4)
	t,bot = "TTH:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",SetMan.GetString(21)
end

SearchArrival = function (user,data)
	local p,n = user.iProfile,user.sNick
	if p == -1 and Core.GetUserValue(user,0) ~= "A" then
		local _,_,search = string.find(data,"([^?]+)|$")
		if search then
			local res = "Unknown Path"..string.char(92)..n..", search is "..
			"disabled for you :P "..string.rep("\t",15)..search
			return Core.SendToUser(user,"$SR "..b.." "..res.." 0 1/2"..t.." ("..i..":"..u..")|"..
			"<"..bot.."> "..n..", search is disabled for you. Please close the "..
			string.format("%q",search:gsub("%$"," ")).." search window. Thank you.|"),true
		end
		return true
	end
end
Everything could have been anything else and it would have just as much meaning.

Scanning

Well, I don't know what was wrong, but now it looks like it's working.

Many thanks to both of you

bastya_elvtars

Mutor, you were using Core.GetUserData and the correct one would have been Core.GetUserValue. This was the only thing I have changed in your script.
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk