alias resolve {
set %resolve.ip $$1
sockopen resolve.ip www.topwebhosts.org 80
.timer 1 3 sockclose resolve.ip
}
on *:sockopen:resolve.ip: {
var %a = sockwrite -n $sockname
%a GET $+(/tools/ip-locator.php?query=,%resolve.ip) HTTP/1.1
%a HOST: topwebhosts.org
%a $crlf
}
on *:sockread:resolve.ip: {
sockread %sockread
if (href='http://www.ip2location.com'> isin %sockread) {
; Geolocation data from IP2Location (Product: DB4)
set %resolve.country1 $remove($gettok($gettok(%sockread,17,47),3-,62),$+($chr(60),img src,$chr(61),$chr(39)))
; Geolocation data from IPligence (Product: Max)
set %resolve.country2 Country: $remove($gettok($gettok(%sockread,50,47),3-,62),$+($chr(60),img src,$chr(61),$chr(39)))
}
if (Registry Information for isin %sockread) {
if ($gettok($regsubex(%sockread,/^[^<]*>|<[^>]*>|<[^>]*$/g,),4,32) == %resolve.ip) {
msg $($+(%,join.chan),2) Welcome to $($+(%,join.chan),2) $($+(%,join.nick),2) $+ . We are glad to have a visitor from $iif(%resolve.country1,%resolve.country1,%resolve.country2) $+ . $&
You are the $ord($($+(%,$($+(%,join.chan),2),joinstotal),2)) visitor and it's your $ord($($+(%,$($+(%,join.nick),2),$($+(%,join.chan),2),joins),2)) join here in %join.chan $+ .
}
}
if (is not a valid IP address isin %sockread) {
msg $($+(%,join.chan),2) Welcome to $($+(%,join.chan),2) $($+(%,join.nick),2) $+ . We are glad to have a visitor from $iif(%resolve.country1,%resolve.country1,%resolve.country2) $+ . $&
You are the $ord($($+(%,$($+(%,join.chan),2),joinstotal),2)) visitor and it's your $ord($($+(%,$($+(%,join.nick),2),$($+(%,join.chan),2),joins),2)) join here in %join.chan $+ .
}
}
on *:join:#: {
set %join.chan $chan
set %join.nick $nick
inc $+(%,#,joinstotal) 1
inc $+(%,$nick,#,joins) 1
userip $nick
}
raw 340:*: { resolve $gettok($$1-,2,64) }
raw 340:*: { resolve $gettok($$1-,2,64) }