I have a php script that is executed by a user and sets "fileone = 1" in the database.
After that script is executed, I would like to add a cron.php as a include.
I want the following php script to execute once automatically after 7 days has past
What I an example of a php script of what I need, but this example does not work.
Can someone help either make this script work or show me one that will?
After that script is executed, I would like to add a cron.php as a include.
I want the following php script to execute once automatically after 7 days has past
Code:
<?php
include "Dbcon.php";
$result = mysql_query("UPDATE myfile SET fileone='0' WHERE fileone='1'")
or die(mysql_error());
mysql_close();
?>
Can someone help either make this script work or show me one that will?
Code:
#!usr/local/lib/php
flag_file="/home/amour/public_html/phplogin/.cleanup_flag"
script_file="/home/amour/public_html/phplogin/cron.php"
offset_days=7
<?php
if ( -z $flag_file ){
time_last_run=`cat $flag_file`;
time_today=`date +%s`;
time_diff=(($time_today-$time_last_run));
time_offset=(($offset_days*86400));
if ( "$time_diff" -ge "$time_offset" ){
php $script_file;
rm $flag_file;
}
}
?>