contatori." where data='$data'"; $result=mysql_query($query); if($visited) { $univoci=0; setcookie("visited","1",time()+21600); } else { $univoci=1; setcookie("visited","1",time()+21600); } if ($vecchioutente) { $nuoviutenti=0; } else { $nuoviutenti=1; setcookie("vecchioutente","1",time()+90000000); } $pagine=1; if (mysql_num_rows($result)) { $query="UPDATE ".$sito->contatori." SET univoci=univoci+$univoci,pagine=pagine+$pagine WHERE data='$data'"; //echo $query; mysql_query($query); } else { $count=0; mysql_query("INSERT INTO ".$sito->contatori." (data,univoci,pagine) values ('$data','$univoci','$pagine')"); } $result=mysql_query("select sum(univoci) as totale from ".$sito->contatori); $count=mysql_result($result,0,'totale'); $NB_DIGITS = 8; header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); header("content-Type: image/jpeg"); $img = ImageCreate(9 * $NB_DIGITS + 1, 17); $bg_color = ImageColorAllocate($img, 255 , 255, 255); $text_color = ImageColorAllocate($img, 255, 255, 255); chop($count); $nb_digits = max(strlen($count), $NB_DIGITS); $txt = substr("0000000000".$count, -$nb_digits); ImageString($img,5,1,0,$txt,$text_color); imagejpeg($img,'',60); ImageDestroy($img); ?>