http://fantacalciobazar.altervista.org/online.php
Questo invece è un online che funziona se richiamato singolarmente mentre non funge se incluso!!!
Codice PHP:
<?
##################################################################################
# FANTACALCIOBAZAR
# Copyright (C) 2003 - 2005 by Antonello Onida (fantacalcio@sassarionline.net)
# Copyright (C) 2001 - 2002 by Marco Maria Francesco De Santis (marcods@gmx.net)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##################################################################################
# CONFIGURAZIONE ONLINE E LOG
$Expire = "60";
$Display = "Utenti connessi: [utenti]";
$AutoMonitor = "1";
$MaxFileSize = "10";
$AutoCorrect = "";
#= CODICE PHP =#
#= $file = ""; @include("online.php");
$file = $_REQUEST['file'];
if (!isset($Expire)) $Expire = 30;
if (isset($file)) $file = "$file";
else $file = "./dati/online.log";
if (!file_exists($file)) @fopen($file,"wb+");
$Online = 0;
$Interval = mktime() - $Expire;
$MaxFileSize = $MaxFileSize * 1000;
$NewUser = mktime()."|".$_SERVER['REMOTE_ADDR']."[x]";
#=================================================================
#= SOVRASCRIVE NUOVE INFO DELL'UTENTE
#=================================================================
if (filesize($file) > $MaxFileSize and $AutoMonitor == "1")
{
$LoggedUsers = ReadLog($file);
$conta=count($LoggedUsers);
for ($x=0;$x<$conta;$x++)
{
if ($Interval <= trim(substr($LoggedUsers[$x],0,10)))
$SavedUsers .= $LoggedUsers[$x]."\r\n";
}
$SavedUsers .= $NewUser;
$handle = @fopen($file,"w");
@flock($handle,LOCK_EX);
@fwrite($handle,$SavedUsers."\r\n");
@flock($handle,LOCK_UN);
@fclose($handle);
}
# LOGGA INFO UTENTI NEL FILE
else
{
$handle = @fopen($file,"a");
@flock($handle,LOCK_EX);
@fwrite($handle,$NewUser."\r\n");
@flock($handle,LOCK_UN);
@fclose($handle);
}
$LoggedUsers = ReadLog($file);
# CONTA GLI UTENTI ONLINE
for ($x=0;$x<count($LoggedUsers);$x++)
{
$UserInfo = explode("|",$LoggedUsers[$x]);
if (isset($CheckUsers)) // VERIFICA NEL FILE SE CI SONO UTENTI DOPPI
{
if ($Interval <= trim($UserInfo[0]) and !stristr($CheckUsers,trim($UserInfo[1])))
{
$CheckUsers .= $UserInfo[1];
$Online++;
}
}
else
{
$CheckUsers .= $_SERVER['REMOTE_ADDR'];
$Online++;
}
}
#=================================================================
#= VISUALIZZAZIONE MESSAGGIO
#=================================================================
$Display = str_replace("[utenti]",$Online,$Display);
if ($Online == 1 and $AutoCorrect == "1")
{
$Display = preg_replace("!s([^[:alpha:]])!","$1",$Display);
$Display = str_replace("Ci sono","C'é",$Display);
}
echo "$Display";
#=================================================================
#= LETTURA FILE LOG
#=================================================================
function ReadLog($file)
{
$handle = @fopen($file,"r");
@flock($handle,LOCK_SH);
$LoggedUsers = @fread($handle,filesize($file));
@flock($handle,LOCK_UN);
@fclose($handle);
$LoggedUsers = trim($LoggedUsers);
$LoggedUsers = substr($LoggedUsers,0,-3);
$LoggedUsers = explode("[x]",$LoggedUsers);
return $LoggedUsers;
}
?>