Count people who is access your web can be used mysql or text, this script used text because if used mysql and many access your web then can be make your web is down.
<?php
if(is_file("count.txt")){
$views2=file_get_contents("count.txt");
$views2=$views2+1;
} else {
$views2=0;
}
$fp = fopen("count.txt", 'w') or die("can't open file");
fwrite($fp, $views2);
fclose($fp);
echo "This page viewed = $views2 times";
?>
if(is_file("count.txt")){
$views2=file_get_contents("count.txt");
$views2=$views2+1;
} else {
$views2=0;
}
$fp = fopen("count.txt", 'w') or die("can't open file");
fwrite($fp, $views2);
fclose($fp);
echo "This page viewed = $views2 times";
?>
0 komentar:
Post a Comment