Contador de visitas by naru

Iniciado por narupiece, Junio 30, 2010, 12:49:58 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Junio 30, 2010, 12:49:58 PM Ultima modificación: Marzo 22, 2014, 02:21:50 PM por Expermicid
hola, aqui les dejo un contador de visitas que hice


Código: php
<?

//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

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta 


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.

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

Saludos! 8)

Buen aporte, lo provare. ^^.


Saludo..

No te líes con:
Código: php
$fp = fopen($archivo,"r");
$contador = fgets($fp, 26);
fclose($fp);


usa file_get_contents($archivo);