Archive

Archive for the ‘Programming’ Category

Cara mudah buat script counter pengunjung dengan php

January 14, 2011 Leave a comment

berikut adalah script untuk counter / monitor mengetahui jumlah pengunjung web tanpa database dengan PHP:

<?php
//—–http://goroot.wordpress.com–//
$cfile = “datapengunjung.dat”;
$fh = fopen($cfile, “r+”);
if (!$fh){
die(“<BR>Gagal membuka file <I>$cfile</I>.”);
}
$s = fgets($fh, 6);
$hitung = (int) $s;
$hitung = $hitung + 1;
$hitung = str_pad($hitung, 6);
//—–http://goroot.wordpress.com–//
rewind($fh);
fwrite($fh, $hitung);
echo “Anda pengunjung ke $hitung<br><br>http://goroot.wordpress.com”;
fclose($fh);
?>Source completed bisa di download disini

 

Categories: PHP, Programming Tags: , , , , ,