<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Echo Data</title> <style> body { color: #000022; background-color: #ddddff; margin-left: 5em; margin-right: 5em; } h1, h2, h3 { text-align: center; font-family: sans-serif; } h1 { font-size: 120%; padding-bottom: 1em; } h2 { font-size: 110%; padding-top: 0.5em; text-decoration: underline; } table { margin-left: auto; margin-right: auto; max-width: 90% } p { text-align: center; } p.date { width: 22em; border: 1pt solid blue; margin-left: auto; margin-right: auto; } p.none { font-style: italic; } td { text-align: right; padding: 0.1em 0.5em; color: #440011; } td + td { text-align: left; color: #000055; } </style> </head> <body> <h1>Data Echo Page</h1> <?php //Generate a table row. function tabrow($key, $val) { echo '<tr><td>', htmlspecialchars($key), ':</td><td>', htmlspecialchars($val), '</td></tr>'; } // Opening page headings. echo '<p class="date">', strftime('%l:%M %P %B %d, %Y'), '</p><h2>Client Data</h2><table>'; // Generate rows of the client information table. tabrow('Client String', $_SERVER['HTTP_USER_AGENT']); $info = get_browser($_SERVER['HTTP_USER_AGENT'],1); tabrow('Client Software', $info['browser'] . ' v. ' . $info['version'] . ' on '. $info['platform']); $ip = $_SERVER['REMOTE_ADDR']; $host = gethostbyaddr($ip); if($host) $ip = "$host ($ip)"; tabrow('Client Address', $ip); tabrow('HTTP Method', $_SERVER['REQUEST_METHOD']); $ref = $_SERVER['HTTP_REFERER']; if($ref) tabrow('Came from', $ref); echo '</table>'; // Request data. $rkeys = array_unique(array_merge(array_keys($_GET), array_keys($_POST))); if($rkeys) { echo "<h2>Request Data</h2><table>"; foreach ($rkeys as $k) tabrow($k, $_REQUEST[$k]); echo '</table>'; } else echo '<p class="none">No request data</p>'; // Cookies. if(count($_COOKIE) > 0) { echo "<h2>Cookies</h2><table>"; $keys = array_keys($_COOKIE); sort($keys); foreach ($keys as $k) tabrow($k, $_COOKIE[$k]); echo '</table>'; } else echo '<p class="none">No cookies</p>'; ?> </body> </html>