I have a question with variable : $_SERVER['REMOTE_ADDR']
.
I wish he recovers ONLY IP addresses in IPv4 format .
It extracted me a few times in IPv6 format .
How to do?
$_SERVER['REMOTE_ADDR']
always contains the address of the visitor. If it contains an IPv6 address then the visitor used IPv6 and there is no IPv4 address. And vice versa of course. These days you have to be able to deal with both.
Some visitors will have only IPv4, some will have only IPv6 and some will have both. The browser decides what is available and what it will use, and that's all you'll see. Note that a browser that has both might even switch between IPv4 and IPv6 between requests if it deems that necessary for good connectivity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With