abbasjoon
Member
سلام بچه ها . من يك كد يوزرهاي انلاين دارم كه تو سايتم گذاشتم. ولي هميشه عدد يك رو نشون مي ده . چه يك نفر توسايت باشه چه 1000 نفر هميشه عدد يك نشون ميده.
اين كدشه :
اينم فایل config
كسي ميتونه كمكم كنه
اين كدشه :
PHP:
<?php
########################################################################
# Copyright © 2001 Wanja Hemmerich #
# First version published April 2001 - This version November 2001 #
########################################################################
# COPYRIGHT NOTICE #
# Copyright 2001 Wanja Hemmerich. All rights reserved. #
# #
# This program may be used and modified, as long as this copyright #
# notice stays intact. #
# #
# Wanja Hemmerich is not responsible for damage, which is possibly #
# caused by his program. #
# #
# This program code may not be sold, nor auctioneered, nor be used in #
# any other commercial way in order to make money. #
# #
# This Programm may not be distributed to download neither by #
# Internet, nor by another medium. #
########################################################################
# By using this programm, you agree with these conditions. #
# #
########################################################################
# The text above must be kept intact under all circumstances. #
########################################################################
include ("./config.php3");
if (!$datei) $datei = dirname(__FILE__)."/$filename";
$time = @time();
$ip = $REMOTE_ADDR;
$string = "$ip|$time\n";
$a = fopen("$filename", "a+");
fputs($a, $string);
fclose($a);
$timeout = time()-(60*$timer);
$all = "";
$i = 0;
$datei = file($filename);
for ($num = 0; $num < count($datei); $num++) {
$pieces = explode("|",$datei[$num]);
if ($pieces[1] > $timeout) {
$all .= $pieces[0];
$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 'Online Users: '.$useronline;
// Delete
$dell = "";
for ($numm = 0; $numm < count($datei); $numm++) {
$tiles = explode("|",$datei[$numm]);
if ($tiles[1] > $timeout) {
$dell .= "$tiles[0]|$tiles[1]";
}
}
if (!$datei) $datei = dirname(__FILE__)."/$filename";
$time = @time();
$ip = $REMOTE_ADDR;
$string = "$dell";
$a = fopen("$filename", "w+");
fputs($a, $string);
fclose($a);
?>
اينم فایل config
PHP:
<?php
// Timeout - After this time the users will
// be deleted (in minutes)
$timer = 100;
// Name of the file where all the data, about
// the user's activity will be saved
$filename = "log.txt";
?>
آخرین ویرایش توسط مدیر: