Last active
June 4, 2022 21:58
-
-
Save gumblex/8d54af5fcbf24b920b80 to your computer and use it in GitHub Desktop.
CGI script: Show visitor's IP and User Agent
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
#!/bin/bash | |
echo 'Status: 200 OK' | |
echo 'Content-Type: text/html; charset=utf-8' | |
echo | |
echo '<!DOCTYPE html>' | |
echo '<html><head>' | |
echo '<meta http-equiv="content-type" content="text/html; charset=UTF-8">' | |
echo '<meta name="description" content="'"$HTTP_USER_AGENT"'">' | |
# we use CloudFlare | |
echo "<title>$HTTP_CF_CONNECTING_IP</title>" | |
echo '</head><body>' | |
echo "<p>$HTTP_CF_CONNECTING_IP</p>" | |
echo "<p>$HTTP_USER_AGENT</p>" | |
echo "<p>$HTTP_REFERER</p>" | |
echo '</body></html>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment