date("d")) { // a new month! $thisMonth = 1; } else { // same month! $thisMonth++; } $dayOfMonthUpdated = date('d'); if(date("D") == "Mon" && $dayOfWeekUpdated != "Mon") { //a new week! $thisWeek = 1; } else { //same week! $thisWeek++; } $dayOfWeekUpdated = date('D'); if($hourUpdated > date("G")) { //a new week! $thisDay = 1; } else { //same week! $thisDay++; } $hourUpdated = date('G'); $ever++; $contents = ""; echo $contents; $file = fopen("counterlog.php",'w'); fwrite($file, $contents); fclose($file); ?>