OK, Now lets see.
--------------------------------------
First run this query in account database.
PHP Code:
DROP TABLE IF EXISTS `iptocountry`;
CREATE TABLE `iptocountry` (
`IP_FROM` varchar(30) NOT NULL default '',
`IP_TO` varchar(30) NOT NULL,
`COUNTRY_NAME` varchar(30) NOT NULL,
PRIMARY KEY (`IP_FROM`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
OK now lets add some ip's.
IP_FROM: Beginning of the ip block.
IP_TO: Ending of the ip block.
COUNTRY_NAME: You need add some name... Country name etc.
Here is the example image by me:
### This function tested by me and %100 working. ###
Here is the C++ code (All of this function.)
PHP Code:
int __cdecl add_blocked_country_ip(int a1)
{
int v1; // eax@1
int v2; // edx@1
char *v3; // ecx@1
char v4; // zf@1
int v6; // [sp+20h] [bp-8h]@1
v1 = operator new(8);
v6 = v1;
v2 = v1;
v3 = *(char **)&s_blocked_ip[4];
v4 = *(_DWORD *)&s_blocked_ip[4] == *(_DWORD *)&s_blocked_ip[8];
*(_DWORD *)v1 = *(_DWORD *)a1;
*(_DWORD *)(v1 + 4) = *(_DWORD *)(a1 + 4);
if ( v4 )
{
std__vector_T_BLOCK_IP___std__allocator_T_BLOCK_IP_______M_insert_aux((int)s_blocked_ip, v3, (int)&v6);
v2 = v6;
}
else
{
if ( v3 )
{
*(_DWORD *)v3 = v1;
v2 = v6;
}
*(_DWORD *)&s_blocked_ip[4] = v3 + 4;
}
return dev_log(
(int)"block_country.cpp",
86,
(int)"add_blocked_country_ip",
2048,
"BLOCKED_IP = %u - %u",
*(_DWORD *)v2,
*(_DWORD *)(v2 + 4));
}
PHP Code:
signed int __cdecl is_blocked_country_ip(int arg)
{
int v1; // eax@2
unsigned int v2; // ecx@2
int v3; // ecx@2
char v4; // t0@2
char v5; // t1@2
signed int result; // eax@8
int v7; // [sp+4h] [bp-24h]@7
int v8; // [sp+8h] [bp-20h]@7
signed int v9; // [sp+Ch] [bp-1Ch]@7
const char *v10; // [sp+10h] [bp-18h]@7
int v11; // [sp+14h] [bp-14h]@7
int v12; // [sp+1Ch] [bp-Ch]@1
if ( __inet_aton(arg, &v12) )
{
v1 = *(_DWORD *)s_blocked_ip;
v3 = v12;
v4 = BYTE1(v3);
BYTE1(v3) = v12;
LOBYTE(v3) = v4;
v2 = __ROR__(v3, 16);
v5 = BYTE1(v2);
BYTE1(v2) = v2;
LOBYTE(v2) = v5;
while ( v1 != *(_DWORD *)&s_blocked_ip[4] )
{
if ( **(_DWORD **)v1 <= v2 && v2 <= *(_DWORD *)(*(_DWORD *)v1 + 4) )
{
v11 = arg;
v10 = "BLOCKED_COUNTRY_IP (%s) : YES";
v9 = 16;
v8 = (int)"is_blocked_country_ip";
v7 = 128;
goto LABEL_8;
}
v1 += 4;
}
dev_log((int)"block_country.cpp", 133, (int)"is_blocked_country_ip", 16, "BLOCKED_COUNTRY_IP (%s) : NO", arg);
result = 0;
}
else
{
v11 = arg;
v9 = 16;
v8 = (int)"is_blocked_country_ip";
v10 = "BLOCKED_COUNTRY_IP (%s) : YES";
v7 = 118;
LABEL_8:
dev_log((int)"block_country.cpp", v7, v8, v9, v10, v11);
result = 1;
}
return result;
}
PHP Code:
void __cdecl __static_initialization_and_destruction_0(int a1, int a2)
{
int v2; // eax@17
int v3; // [sp+4h] [bp-34h]@12
if ( a2 == 65535 )
{
if ( a1 == 1 )
{
std__ios_base__Init__Init(&std____ioinit);
*(_DWORD *)s_blocked_ip = 0;
*(_DWORD *)&s_blocked_ip[4] = 0;
*(_DWORD *)&s_blocked_ip[8] = 0;
*(_DWORD *)s_block_exception = 0;
v2 = std____default_alloc_template_true_0___allocate(0);
*(_DWORD *)s_block_exception = v2;
*(_DWORD *)(v2 + 4) = 0;
*(_DWORD *)v2 = 0;
*(_DWORD *)&s_block_exception[4] = 0;
*(_DWORD *)(*(_DWORD *)s_block_exception + 8) = *(_DWORD *)s_block_exception;
*(_DWORD *)(*(_DWORD *)s_block_exception + 12) = *(_DWORD *)s_block_exception;
}
if ( !a1 )
{
if ( *(_DWORD *)&s_block_exception[4] )
{
std___Rb_tree_std__string_std__string_std___Identity_std__string__std__less_std__string__std__allocator_std__string_____M_erase(
(int)s_block_exception,
*(void **)(*(_DWORD *)s_block_exception + 4));
*(_DWORD *)(*(_DWORD *)s_block_exception + 8) = *(_DWORD *)s_block_exception;
*(_DWORD *)(*(_DWORD *)s_block_exception + 4) = 0;
*(_DWORD *)(*(_DWORD *)s_block_exception + 12) = *(_DWORD *)s_block_exception;
*(_DWORD *)&s_block_exception[4] = 0;
}
std____default_alloc_template_true_0___deallocate(*(_DWORD *)s_block_exception, 20);
}
if ( a2 == 65535 )
{
if ( !a1 )
{
if ( (*(_DWORD *)&s_blocked_ip[8] - *(_DWORD *)s_blocked_ip) >> 2 )
std____default_alloc_template_true_0___deallocate(
*(_DWORD *)s_blocked_ip,
4 * ((*(_DWORD *)&s_blocked_ip[8] - *(_DWORD *)s_blocked_ip) >> 2));
}
if ( a2 == 65535 )
{
if ( !a1 )
std__ios_base__Init___Init(&std____ioinit, v3);
}
}
}
}






>