Last active
August 29, 2015 14:10
-
-
Save ConoHa/fb7c783153a37c7a4882 to your computer and use it in GitHub Desktop.
このべん第4回 確認用index.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 h($str) { | |
echo htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); | |
} | |
?> | |
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"> | |
<style> | |
BODY { | |
padding: 2em | |
} | |
TABLE { | |
border-collapse: collapse; | |
margin-bottom: 3em; | |
} | |
TH,TD { | |
text-align: left; | |
padding: 0.5em; | |
border: 1px solid #CCC; | |
} | |
</style> | |
</head> | |
<body> | |
<h2>Webサーバのアドレス</h2> | |
<table> | |
<tr> | |
<th><?php h($_SERVER['SERVER_ADDR']) ?></th> | |
</tr> | |
</table> | |
<h2>接続元の情報</h2> | |
<table> | |
<tr> | |
<th>接続元のアドレス</th> | |
<td><?php h($_SERVER['REMOTE_ADDR']) ?></td> | |
</tr> | |
<tr> | |
<th>接続元のアドレス(X-Forwarded-Forヘッダ)</th> | |
<td><?php h($_SERVER['HTTP_X_FORWARDED_FOR']) ?></td> | |
</tr> | |
</table> | |
<h4>HTTPリクエストヘッダ</h4> | |
<table> | |
<?php foreach($_SERVER as $name => $value): ?> | |
<tr> | |
<th><?php h($name) ?></th> | |
<td><?php h($value) ?></td> | |
</tr> | |
<?php endforeach; ?> | |
</table> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment