RegisteredUsers.xml from Verlihub
 

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

RegisteredUsers.xml from Verlihub

Started by ATAG, 12 May, 2009, 21:57:29

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ATAG

-- vh_reg2px.lua v0.01
-- by ATAG @ 2009.05.12.

-- ########################################
-- THIS IS A VERLIHUB SCRIPT! DO NOT USE IT ON PTOKAX HUB!
-- ########################################

classtable = {
[1] = 3,
[2] = 2,
[3] = 1,
[4] = 1,
[5] = 1,
[10] = 0
}

regusers = { }

function Main()
	local f, e = io.open( ".verlihub/RegisteredUsers.xml" )
	if f then
		local reg = {}
		for line in f:lines() do
			local _,_, var, val  = string.find( line, ".*<(.-)>([^<]*)</%1>" )
			if var then
				if var == "Profile" then
					regusers[ reg["Nick"] ] = { reg["Password"] , val }
					reg = {}
				else
					reg[ var ] = val
				end
			end
		end
	end
end

temp = {}

function VH_OnParsedMsgAny( sNick, sData )
	if string.sub( sData, 1, 7 ) == "$MyPass" then
		temp[ sNick ] = string.sub( sData, 9 )
	end
	return 1
end

function VH_OnUserLogin( sNick )
	if temp[ sNick ] then
		local res, class = VH:GetUserClass( sNick )
		if res then
			class = tonumber( class )
			if classtable[ class ] then
				regusers[ sNick ] = { temp[ sNick ], classtable[ class ] }
			end
		end
		temp[ sNick ] = nil
	end
	return 1
end

function UnLoad()
	local f, e = io.open( ".verlihub/RegisteredUsers.xml", "w+" )
	if f then
		f:write("<?xml version=\"1.0\" encoding=\"windows-1252\" standalone=\"yes\" ?>\n")
		f:write("<RegisteredUsers>\n")
		for nick in pairs( regusers ) do
			f:write("\t<RegisteredUser>\n"..
				"\t\t<Nick>" .. nick .. "</Nick>\n"..
				"\t\t<Password>" .. ( regusers[ nick ][1] or "" ) .."</Password>\n"..
				"\t\t<Profile>" .. ( regusers[ nick ][2] or "3" ) .. "</Profile>\n"..
				"\t</RegisteredUser>\n"
			)
		end
		f:write("</RegisteredUsers>")
		f:flush()
		f:close()
	end
end

SMF spam blocked by CleanTalk