Created
August 6, 2016 15:31
-
-
Save Restoration/e1eb8c5e884114dbe3a1b3c8a08dd69d to your computer and use it in GitHub Desktop.
環境変数の情報取得
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
| <!DOCTYPE> | |
| <html lang="ja"> | |
| <head> | |
| <title>環境変数の情報取得</title> | |
| </head> | |
| <body> | |
| <?php | |
| function h($var){ | |
| if(is_array($var)){ | |
| return array_map('h',$var); | |
| } else { | |
| return htmlspecialchars($var, ENT_QUOTES, 'UTF-8'); | |
| } | |
| } | |
| $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGETN'] : ''; | |
| $ip = isset($_SERVER['REMORT_ADDR']) ? $_SERVER['REMROT_ADDR'] : ''; | |
| $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; | |
| echo 'ブラウザ、ユーザーエージェント:'.h($agent).'<br />'; | |
| echo 'IPアドレス:'.h($ip).'<br />'; | |
| echo '参照元' . h($ref). '<br />'; | |
| echo '<pre>'; | |
| echo var_dump(h($_SERVER)); | |
| echo '</pre>'; | |
| ?> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment