Last active
July 6, 2023 04:54
-
-
Save afsalrahim/a7dcccbc5357299b95e2 to your computer and use it in GitHub Desktop.
Show user information like IP address, useragent
This file contains hidden or 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 | |
/** | |
* Show user information like IP address, useragent | |
**/ | |
$ip = $_SERVER['REMOTE_ADDR']; | |
$browser = $_SERVER['HTTP_USER_AGENT']; | |
$referrer = $_SERVER['HTTP_REFERER']; | |
if ($referrer == "") { | |
$referrer = "This page was accessed directly"; | |
} | |
echo "<b>Visitor IP address:</b><br/>" . $ip . "<br/>"; | |
echo "<b>Browser (User Agent) Info:</b><br/>" . $browser . "<br/>"; | |
echo "<b>Referrer:</b><br/>" . $referrer . "<br/>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment