The application IP address of the pure IP database is converted to decimal. The original code for copying an IP address in decimal format is as follows: $ ip $ _ SERVER [REMOTE_ADDR]; echo your IP address :. $ ip.br; $ ip_arrexplode (., $ ip); $ ip0; foreach ($ ip_arras $ I originally needed to convert the IP address to a decimal number.
The code is as follows:
$ Ip = $ _ SERVER ['remote _ ADDR '];
Echo 'Your IP address: '. $ ip .'
';
$ Ip_arr = explode (".", $ ip );
$ Ip = 0;
Foreach ($ ip_arr as $ I => $ s ){
$ Ip + = $ s * pow (256, 3-$ I );
}
Echo 'convert to decimal value: '. $ ip .'
';
// Result: Your IP address is 127.0.0.1.
Decimal: 2130706433
The authorization code is as follows: $ ip = $ _ SERVER ['remote _ ADDR ']; echo 'Your IP address :'. $ ip. 'Br/'; $ ip_arr = explode (". ", $ ip); $ ip = 0; foreach ($ ip_arr as $ I...