14.04.2013, 11:28
(
Последний раз редактировалось Luka P.; 17.04.2013 в 20:47.
)
Function to check is some IP address within an IP range. You need to have strexplode.
Код:
stock ip2int(ip_address[16]) { new sIP[4][4], IP[4]; strexplode(sIP, ip_address, !".", _, false, _, 4, 4); for(new i = 0; i < sizeof(IP); i++) IP[i] = strval(sIP[i]); return -(IP[0] * 2^24) + (IP[1] * 2^16) + (IP[2] * 2^8) + (IP[3]); } stock IsIPInRange(ip[16], range_start[16], range_end[16]) return ip2int(range_start) <= ip2int(ip) <= ip2int(range_end);