hola, aqui les dejo un contador de visitas que hice
<?
//Powered By The Legend Hack
$archivo="contador.txt";
$contador="0";
$num_max="9999999";
if ( file_exists ( $archivo )) {
$fp = fopen($archivo,"r");
$contador = fgets($fp, 26);
fclose($fp);
} else {
$fp = fopen($archivo,"w");
fputs($fp,"1");
fclose($fp);
}
++$contador;
$fp = fopen($archivo,"w+");
fwrite($fp, $contador, 26);
fclose($fp);
if ($contador>=$num_max) {
$imagen = imagecreatefromgif("fondo.gif");
$colText = imagecolorallocate($imagen, 255, 255, 255);
imagestring($imagen, 5, 16, 7, $num_max , $colText);
header("Content-type: image/gif");
imagegif($imagen);
}
else
{
$imagen = imagecreatefromgif("fondo.gif");
$colText = imagecolorallocate($imagen, 255, 255, 255);
imagestring($imagen, 5, 16, 7, $contador , $colText);
header("Content-type: image/gif");
imagegif($imagen);
}
?>
aqui la imagen de fondo xD
http://img18.imageshack.us/img18/5143/fondom.gif (http://img18.imageshack.us/img18/5143/fondom.gif)
bueno, espero que les sirva ;) solo guardan el codigo con el nombre que quieran y lo suben a un hosting junto con la imagen de fondo.
Demo de Contador (http://narupiece.webcindario.com/contador/contador.php)
Saludos! 8)
Buen aporte, lo provare. ^^.
Saludo..
No te líes con:
$fp = fopen($archivo,"r");
$contador = fgets($fp, 26);
fclose($fp);
usa file_get_contents($archivo);