PDA

View Full Version : سوال: دستکاری کد آمارگیر



alih110
دوشنبه 28 دی 1388, 16:16 عصر
سلام دوستان یک کد آمار گیر ساده هست



<?

// Open the file "visits.txt", which contains a number, usually 0 if this
// is a new site. Make sure this file has been set on the server to allow
// changes to be made.

if ($file = fopen("visits.txt", "r")) {

// Set $visits to be the number read from "visits.txt".
// This reads the first 6 characters which will plenty unless the site
// is getting massive hits, in which case you'll be using
// a much better counter.

$visits = (fgets($file, 6));

// Increment the number by 1 to count this new visit.

++$visits;

//Print the new count.

echo("".$visits);

//Close the file "visits.txt"

fclose($file);
}


// Open the file "visits.txt" again, this time in write only mode.

if ($file = fopen("visits.txt", "w")) {


// Write the new incremented number to the file.

fputs($file, $visits);


// Close the file.

fclose($file);
}

?>



حالا من میخوام آمار امروز رو بهش اضافه کنم

یعنی آمار امروز و آمار کل میشه کمک کنید