- $req=mysql_query("SELECT * FROM cron WHERE `id`='1'");
- $res = mysql_fetch_array($req);
- $day = $res[day];
- $month = $res[month];
- $year = $res[year];
- $seconds = $res[seconds];
- $minutes = $res[minutes];
- $hour = $res[hour];
- $repete=$res[frequency];
-
- $date_actuelle = time();
- $date_a_venir = mktime($hour, $minutes, $seconds, $month, $day, $year);
-
- echo "<center><b><i>Date actuelle ::> $date_actuelle -- $date_a_venir <:: Prochaine execution</i></b></center>";
-
- if($date_actuelle>$date_a_venir)
- {
- $next=getdate($date_a_venir + ($repete*3600) );
- $year=$next[year];
- $month=$next[mon];
- $day=$next[mday];
- $hour=$next[hours];
- $minutes=$next[minutes];
- $seconds=$next[seconds];
- mysql_query('UPDATE cron SET year= "'.$year.'", month="'.$month.'", day="'.$day.'", hour="'.$hour.'", minutes="'.$minutes.'", seconds="'.$seconds.'" where id=1');
- echo "<center><b>Execution de la requete</center></b>";
- }
$req=mysql_query("SELECT * FROM cron WHERE `id`='1'");
$res = mysql_fetch_array($req);
$day = $res[day];
$month = $res[month];
$year = $res[year];
$seconds = $res[seconds];
$minutes = $res[minutes];
$hour = $res[hour];
$repete=$res[frequency];
$date_actuelle = time();
$date_a_venir = mktime($hour, $minutes, $seconds, $month, $day, $year);
echo "<center><b><i>Date actuelle ::> $date_actuelle -- $date_a_venir <:: Prochaine execution</i></b></center>";
if($date_actuelle>$date_a_venir)
{
$next=getdate($date_a_venir + ($repete*3600) );
$year=$next[year];
$month=$next[mon];
$day=$next[mday];
$hour=$next[hours];
$minutes=$next[minutes];
$seconds=$next[seconds];
mysql_query('UPDATE cron SET year= "'.$year.'", month="'.$month.'", day="'.$day.'", hour="'.$hour.'", minutes="'.$minutes.'", seconds="'.$seconds.'" where id=1');
echo "<center><b>Execution de la requete</center></b>";
}