No Hace Nada GRRR - fopen , print o algo
| From: | Webmaster - Barra Home | Date: | Wed, 22 Aug 2001 20:00:40 +0000 |
| Subject: | No Hace Nada GRRR - fopen , print o algo | ||
| Groups: | php.general.es | ||
| Request: | Send a blank email to general-es+get-13163@lists.php.net to get a copy of this message | ||
<?
Esta variable define el número de digitos que imprimira el contador (Ej:
00000x)
$digits = 6;
Esta variable indica el nombre del documento que contabilizara las visitas
$filelocation="visitas.txt";
Esta variable incluye un texto en el resultado del contador
$text="Eres el visitante número";
Esta variable indica la fecha desde donde inicia la cuenta
$date="desde 09/07/2001";
if (!file_exists($filelocation)) {
$newfile = fopen($filelocation,"w+");
$content=1;
fwrite($newfile, $content);
fclose($newfile);
}
$newfile = fopen($filelocation,"r");
$content = fread($newfile, filesize($filelocation));
fclose($newfile);
$newfile = fopen($filelocation,"w+");
if (!$c){
$content++;
}
fwrite($newfile, $content);
fclose($newfile);
echo "".sprintf ($text,"%0"."$digits"."d",$content,
$date)."";
?>