pastebin
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
pastebin
Follow @pastebin
create new paste
trending pastes
sign up
login
my settings
my profile
My Pastes
Public Pastes
Untitled
4 sec ago
Ehi Ci Stai?
31 sec ago
Untitled
10 sec ago
a faire
17 sec ago
Untitled
22 sec ago
Uploading.com Premium A...
25 sec ago
Untitled
29 sec ago
Untitled
51 sec ago
Layout Width
Share Pastebin
sirboderafael
By: a guest | Mar 1st, 2009 | Syntax:
PHP
| Size: 1.05 KB | Hits: 383 | Expires: Never
Download
|
Raw
|
Embed
|
Report abuse
<?
$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>
create new paste
|
create new version of this paste
RAW Paste Data