Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $ultimas_linhas = array_reverse(
- array_slice(
- file('./log'),
- -10
- )
- );
- $ultimos_dados = array();
- foreach ($ultimas_linhas as $linha) {
- $partes = explode(":", $linha);
- if (isset($partes[0]) && isset($partes[2])) {
- array_push(
- $ultimos_dados,
- array(
- 'ip' => trim($partes[0]),
- 'informacao' => trim($partes[2])
- )
- );
- }
- }
- ?>
- <html>
- <head>
- <meta http-equiv="refresh" content="5">
- <title>Monitor de logs - Servidor GPS na porta 25000 UDP</title>
- </head>
- <body>
- <h1>Monitor de logs - Servidor GPS na porta 25000 UDP</h1>
- <h2>Atualizando a página a cada 5 segundos...</h2>
- <p>Últimos 10 dados recebidos:
- <ul>
- <? foreach ($ultimos_dados as $dado) { ?>
- <li><?= $dado['ip'].' : '.$dado['informacao']; ?></li>
- <? } ?>
- </ul>
- </p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement