$fp = fopen($filename,"w"); // If its the first day of the month and there are less than 1500 downloads, reset the // counter file to 0 (this depends on not having more than 1500 downloads on day 1st!!) if (date("d") == 1 && $data > 1500) { fputs($fp,0); // Also reset visits counter $VisCounter = fopen("../visits_counter.dat","w"); fputs($VisCounter,0);} // else just keep counting