Usuários online inteligente!
#1
Posted 17/01/2003, 20:05
esse é o meu site... de rom e emuladores... http://www.worldemulators.kit.net ateh mais galera!!
#2
Posted 17/01/2003, 20:10
#3
Posted 17/01/2003, 20:32
<?
$version = "ver 1.0";
// Timeout - After this time the users will
// be deleted (in minutes)
$timer = 30;
/*
**
** DON'T MODIFY BELOW
**
*/
// Name of the file where all the data, about
// the user's activity will be saved
// Chmod for log.txt file is 666
$filename = "log.txt";
if (!$datei) $datei = dirname(__FILE__)."/$filename";
$time = @time();
// Encode IP to anti Hacker
$realip = $REMOTE_ADDR;
$div = explode('.',$realip);
$div0 = $div[0];
$div1 = $div[1];
$div2 = $div[2];
$div3 = $div[3];
$salt = "20";
$fakediv0 = $div[0]*md5($salt);
$fakediv1 = $div[1]*md5($salt);
$fakediv2 = $div[2]*md5($salt);
$fakediv3 = $div[3]*md5($salt);
$fakeip = "$fakediv0.$fakediv1.$fakediv2.$fakediv3";
$access = $QUERY_STRING;
$string = "$access|$fakeip|$time\n";
$a = fopen("$filename", "a+");
fputs($a, $string);
fclose($a);
$timeout = time()-(60*$timer);
$all = "";
$i = 0;
$datei = file($filename);
for ($numff = 0; $numff < count($datei); $numff++) {
$pieces = explode("|",$datei[$numff]);
if ($pieces[2] > $timeout) {
$all .= $pieces[1];
$all .= ",";
}
$i++;
}
$all = substr($all,0,strlen($all)-1);
$arraypieces = explode(",",$all);
$useronline = count(array_flip(array_flip($arraypieces)));
// display how many people where activ within $timeout
//echo $useronline;
// Delete
$dell = "";
for ($numm = 0; $numm < count($datei); $numm++) {
$tiles = explode("|",$datei[$numm]);
if ($tiles[2] > $timeout) {
$dell .= "$tiles[0]|$tiles[1]|$tiles[2]";
}
}
if (!$datei) $datei = dirname(__FILE__)."/$filename";
$time = @time();
$string = "$dell";
$a = fopen("$filename", "w+");
fputs($a, $string);
fclose($a);
?>
<?
echo $useronline;
if($useronline == "1"){
echo " usuário online";
}
ELSE{
echo " usuários online";
}
?>
E o dele é inteligente mesmo so muda quando entra ou sai alguém não sei se vc percebeu gostaria de saber se ha possibilida de eu arranjar um assim... ok mais valews so me explica ai como faz atualiza em pucos segundo ateh mais e se alguém souber algo diferente disso ?
#4
Posted 17/01/2003, 20:44
http://pokeviciados....t.net/online.pl
si vc kizer... da um exibir.. a cada 10 segundos ele atualiza.. heheh soh ki eli si refere a eli a partir di um iframe.. si kize copia u codigu i poe nu inicio do seu php, antis di inviar nda pro navegador
#5
Posted 17/01/2003, 21:00
#6
Posted 17/01/2003, 21:07
no seu script php
antis du <? ?>
vc poe o code html pra atualizar automaticamente
#7
Posted 18/01/2003, 14:50
eh bem legal isto...
se quiser falae q eu coloco aqui para donwload...
#8
Posted 18/01/2003, 17:54
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)