Last active
February 21, 2022 06:50
-
-
Save MajideND/f36251541b9b0d7ab5990f4ab2628934 to your computer and use it in GitHub Desktop.
Safest code to get user real IP Address in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function _getUserRealIP() { | |
$ipaddress = ''; | |
if(isset($_SERVER['REMOTE_ADDR'])) | |
$ipaddress = $_SERVER['REMOTE_ADDR']; | |
else | |
$ipaddress = 'UNKNOWN'; | |
return $ipaddress; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment