Skip to content

Instantly share code, notes, and snippets.

@ConoHa
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ConoHa/fb7c783153a37c7a4882 to your computer and use it in GitHub Desktop.
Save ConoHa/fb7c783153a37c7a4882 to your computer and use it in GitHub Desktop.
このべん第4回 確認用index.php
<?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