GeoIP for Lua5 - Page 4
 

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

GeoIP for Lua5

Started by VidFamne, 08 March, 2005, 21:15:04

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

UwV

part 1
--// geo-html-addon.v.1.7 
--
--// GeoIP version  0.7a hmtl addon,  for: *Chilla tha spliff killa*  by: UwV (based most code on Mutor's webpack) 
--// thanks for all the lessons sir Mowgli !!!
--
--// and thanks to Mutor to
--
--// Dependencies :
--// 1. Ptokax 0.3.3.21 
--// 2. you need to have Mowgli's GeoIP-.lua  ( v.0.7a or higher) to run this.
--
--//  "This product runs with GeoIP-0.7a created by Chilla, available from http://board.univ-angers.fr" 
--// You may use/copy/edit this code, but you may never compile one single bit of it
--// Open code rocks, I am not ashaimed of my sloppy coding :), I like it
--// Try to compile your words and then try to make yourself understood
--// Open Code is like sharing thaughts, and as we know sharing is caring, feels good
--//  "That product runs with GeoIP data created by MaxMind, available from http://maxmind.com/"

GenerateEvery = 2	 -- minutes between page generation

--// set "filepath/name.html" for .html's, table headers & page tops
htmlfile1 = frmHub:GetPtokaXLocation().."html/webstats/geo-ip-onlinecountrys.html"
top1 = "GeoIP-LUA Live Online Country's for:"
header1l = "Rank" header1m = "Nr." header1r = "Country"

htmlfile2 = frmHub:GetPtokaXLocation().."html/webstats/geo-ip-connectionhistory.html"
top2 = "GeoIP-LUA Country Connection Count for:"
header2l = "Ranking" header2m = "Nr." header2r = "Country"

htmlfile3 = frmHub:GetPtokaXLocation().."html/webstats/geo-ip-onlinecountryhistory.html"
top3 = "GeoIP-LUA Top online Country History for:"
header3l = "Ranked" header3m = "Nr." header3r = "Countrys"

color1 = "#FF0023"
color2 = "#FFFF23"
color3 = "#23FF23"
--------- end user settings -------------------------------------
\NL   The knowledge and skills you have achieved are meant to be forgotten so you can float comfortably in emptiness, without obstruction.
" Holly loves me,...  . "      ;o)

& don't forget, the motto is :
  -- SUPPORT YOUR LOCAL DJ'S --

UwV

part 2
--// script start

dofile("IP-Bot/GeoIPFullStats.txt")
THEhub, daversion = getHubVersion() 

function Main()
	local fileinFolder = io.open( htmlfile1, "r" )
	if not fileinFolder then
		os.execute( "mkdir \""..frmHub:GetPtokaXLocation().."html/webstats" )
	end
	SetTimer(60000*GenerateEvery)
	StartTimer()
	OnTimer()
end

function OnTimer()
	SaveOnlineHtml(htmlfile1, header1l, header1m, header1r)	
	SaveConnectHtml(htmlfile2,header2l, header2m, header2r)
	SaveTopHtml(htmlfile3, header3l, header3m, header3r)
end

function SaveOnlineHtml(htmlfile, header1, header2, header3)
	local totalonline = 0
	local File = io.open(htmlfile, "w")
	if File then
		diff = nil
		local t1 = os.clock()
		File:write("\\\r\n \ GeoIP.lua  by: Mowgli for "..THEhub.." "..daversion..", Stats Provided by: -=D*S*N=-  DEEP SPACE NETWORK                    .\r\n\\r\n\\r\n")
		File:write("\r\n\t\t\\\\"..top1.."\\\\"..frmHub:GetHubName().."\\\r\n\t\t") 
		File:write("\\r\n\t\t\t\\r\n")
		File:write("\t\t\t\t\\
\\"..header1.."\\\\\\•\ \\"..header2.."\\\•\\\\\\\"..header3.."\\\\\\r\n") for i,v in GeoIPOnlineCountries do totalonline = totalonline + v[2] File:write( "\t\t\t\t\\\" ..i.. ".\t \\  \\•\ \"..v[2].." \•\\\"..v[1].."\\\\r\n") end File:write("\t\t\t\t\\\Antennae Online\\  \\"..totalonline.." \ \\\"..os.date("%m/%d/%y  %I:%M %p ").."\\\r\n") local diff = os.clock() - t1 File:write("\t\t\t\t\\ \\ \\ \\\\r\n") File:write("\t\t\t\t\\\ Page last updated on:\\\ \\"..os.date("%m/%d/%y  %I:%M %p ").."\\\\r\n") File:write("\t\t\t\t\\\ Page generated in: \\\"..string.format("%.5f", diff ).."\\\ secs. by \LUA script \!!\\\\r\n") File:write("\t\t\t\t\\ \\ \\ \\\\r\n") File:write("\t\t\t\\r\n\t\t\\r\n\t\\r\n\") File:close() else File:write("") end end function SaveConnectHtml(htmlfile, header1, header2, header3) local totalconnects = 0 local File = io.open(htmlfile, "w") if File then diffa = nil local t1a = os.clock() File:write("\\\r\n \ GeoIP.lua  by: Mowgli for "..THEhub.." "..daversion..", Stats Provided by: -=D*S*N=-  DEEP SPACE NETWORK                    .\r\n\\r\n\\r\n") File:write("\r\n\t\t\\\\"..top2.."\\\\"..frmHub:GetHubName().."\\\r\n\t\t") File:write("\\r\n\t\t\t\\r\n") File:write(" \t\t\t\t\\
\\\"..header1.."\\\ \ \•\ \\"..header2.."\\ \•\ \\\\\\"..header3.."\\\\\\r\n") for i,v in GeoIPConnectCountries do totalconnects = totalconnects + v[2] File:write( "\t\t\t\t\\\" ..i.. ".\t \\  \\•\ \"..v[2].." \•\\\"..v[1].."\\\\r\n" ) end File:write( " \t\t\t\t\\ \Total Connections:\\ \"..totalconnects.."\ \\GeoIP started: "..GeoIPStatsDate.."\\\\r\n" ) local diffa = os.clock() - t1a File:write("\t\t\t\t\\ \\ \\ \\\\r\n") File:write("\t\t\t\t\\\ Page last updated on:\\\ \\"..os.date("%m/%d/%y  %I:%M %p ").."\\\\r\n") File:write("\t\t\t\t\\\ Page generated in: \\\"..string.format("%.5f", diffa ).."\\\ secs. by \LUA script \!!\\\\r\n") File:write("\t\t\t\t\\ \\ \\ \\\\r\n") File:write("\t\t\t\\r\n\t\t\\r\n\t\\r\n\") File:close() else File:write("") end end function SaveTopHtml(htmlfile, header1, header2, header3) local totalconnects = 0 local File = io.open(htmlfile, "w") if File then diffb = nil local t1b = os.clock() File:write("\\\r\n \ GeoIP.lua  by: Mowgli for "..THEhub.." "..daversion..", Stats Provided by: -=D*S*N=-  DEEP SPACE NETWORK                    .\r\n\\r\n\\r\n") File:write("\r\n\t\t\\\\"..top3.."\\\\"..frmHub:GetHubName().."\\\r\n\t\t") File:write("\\r\n\t\t\t\\r\n") File:write(" \t\t\t\t\\
\\\"..header1.."\\\ \ \•\ \\"..header2.."\\ \•\ \\\\\\"..header3.."\\\\\\r\n") for i,v in GeoIPMaxConnectedCountries do totalconnects = totalconnects + v[2] File:write( "\t\t\t\t\\\" ..i.. ".\t \\  \\•\ \"..v[2].." \•\\\"..v[1].."\\\\r\n" ) end local diffb = os.clock() - t1b File:write("\t\t\t\t\\ \\ \\ \\\\r\n") File:write("\t\t\t\t\\\ Page last updated on:\\\ \\"..os.date("%m/%d/%y  %I:%M %p ").."\\\\r\n") File:write("\t\t\t\t\\\ Page generated in: \\\"..string.format("%.5f", diffb ).."\\\ secs. by \LUA script \!!\\\\r\n") File:write("\t\t\t\t\\ \\ \\ \\\\r\n") File:write("\t\t\t\\r\n\t\t\\r\n\t\\r\n\") File:close() else File:write("") end end
\NL   The knowledge and skills you have achieved are meant to be forgotten so you can float comfortably in emptiness, without obstruction.
" Holly loves me,...  . "      ;o)

& don't forget, the motto is :
  -- SUPPORT YOUR LOCAL DJ'S --

SMF spam blocked by CleanTalk