Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

PHPCounter

A simple counter that memorizes the number of accesses in a text file.



<?
$version = "0,21";
$counterstyle = "image";
$invisible = "no";
$height = "19";
$width = "15";
$hitsfile = "";
$images = "";
if (!$hitsfile) $hitsfile = dirname(__FILE__)."/hits";
    if (!$images) $images = dirname(__FILE__)."/images";
        $images = str_replace($DOCUMENT_ROOT, "", $images);
        $hits = file($hitsfile);
        $hits = $hits[0] + 1;
        $fp = fopen($hitsfile, "w");
        fwrite($fp, $hits);
            if ($invisible != "yes") {
                if ($counterstyle == "text") {
                    echo $hits;
                }
                else {
                    $digit = strval($hits);
                        for ($i = 0; $i < strlen($hits); $i++) {
                            echo "<img src=$images/$digit[$i].gif height=$height width=$width alt=$hits>";
                        }
                }
            }
?>
Note: the script uses the images in "images" folder


Download code...


Print this page


 

Inizio pagina

risorse per webmaster