Skip to content

Instantly share code, notes, and snippets.

@gumblex gumblex/

Last active Mar 1, 2016
What would you like to do?
CGI script: Show visitor's IP and User Agent
echo 'Status: 200 OK'
echo 'Content-Type: text/html; charset=utf-8'
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
You can’t perform that action at this time.