Ciao ragazzi. io ho messo sul mio sito un "coso" in php che mi mostra gli utenti connessi. Il prob è che io ho inserito questo codice php in questo modo:
codice:
<font face="Verdana"><span style="font-size:7pt;">Ci
sono <?php
########################################################################
# Copyright © 2001 Wanja Hemmerich #
# Erstellt April 2001 #
########################################################################
# COPYRIGHT NOTIZ #
# Copyright 2001 Wanja Hemmerich Alle Rechte vorbehalten #
# #
# Dieses Programm darf benutzt und modifiziert werden solange diese #
# Copyrightnotiz intakt gehalten wird. #
# #
# Wanja Hemmerich kommt nicht für Schaden auf, der durch #
# sein Programm möglicherweise verursacht wird. #
# #
# Dieser Programmcode darf weder verkauft, versteigert noch vermietet #
# werden noch auf irgend eine andere kommerzielle Weise dazu benutzt #
# werden, um Geld zu machen. #
# #
# Dieses Programm darf weder durch das Internet, noch durch ein #
# anderes Medium vervielvältigt werden. #
########################################################################
# Mit der Nutzung dieses Programmes erklären Sie sich mit diesen #
# Bedingungen einverstanden #
# #
########################################################################
# Der obige Text muss unten allen Umständen intakt gehalten werden. #
########################################################################
// Timeout - Nach dieser Zeit werden die User
// aus der Datenbank gelöscht (in Minuten)
$timer = 2;
// Die Datei wo alle Daten über die anzahl
// der User die grade online sind gespeichert wird
$filename = "log.txt";
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);
echo "<font face=\"Verdana\" size=\"-2\">"; $useronline = count(array_flip(array_flip($arraypieces)));
$useronline = count(array_flip(array_flip($arraypieces)));
if ($useronline == 0) {
$useronline = 1;
}
echo " $useronline </font>";
// Löschen
$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);
?></span></font> <font face="Verdana"><span style="font-size:7pt;">mafiosi
connessi </span></font>
come avrete notato non ho editato molto il codice php, quindi se x esempio c'è 1 solo utente connesso, viene scritto "Ci sono 1 mafiosi connessi"...
cosa devo editare x far si che se c'è 1 solo utente connesso, appaia al singolare?
mi avevano detto in 1 altro topic di fare 1 controllo sulle variabili
ma io nn ne capisco molto
grazie in anticipo!