//--------------------------------------------------------------
// PLACE THIS CODE AT THE TOP OF YOUR SCRIPT
//--------------------------------------------------------------
// The following code insures that your cron script responds
// only to the local web server, otherwise your script could
// be triggered by external web clients.
if ( "127.0.0.1" != getenv("REMOTE_ADDR") ) exit;
// The following code insures that your script runs *once* a day
// in the hour long window you specifiy.
// IMPORTANT: Change the values of HOURS and MINS for your cron script.
// Hour and minute to start the hour-long window for running this script.
// The time is the local time, which will be adjusted for DST.
// (NOTE: Hours run from 0 to 23.)
//
$HOURS = 6;
$MINS = 30;
// Run job if we are in the correct time window
$time_array = getdate();
$hours = $time_array["hours"];
$mins = $time_array["minutes"];
if ( ! ($hours==$HOURS and $mins>=$MINS or $hours==($HOURS+1)%24 and $mins<$MINS) ) {
exit;
}
//--------------------------------------------------------------
// YOUR SCRIPT FOLLOWS HERE
//--------------------------------------------------------------