This Message Forum is no longer in use

Please use the new Bravenet Help Forums FOUND HERE

General Forum
This Forum is Locked
Author
Comment
Setting up a cron.php job using bravenet

i need to set this cron job to run daily at 10 AM ,

anyone know how?
Thanks, Ed

set_time_limit(129600);
include "config.php";

//Prevent abuse
$today = date('Y-m-d', strtotime("now"));
$query_i = "SELECT * FROM settings where name='lastresponder'";
$result_i = mysql_query ($query_i);
$row_i = mysql_fetch_array($result_i);
$lastsetting = $row_i["setting"];
if($lastsetting!=$today){
$query123 = "update settings set setting='$today' where name='lastresponder'";
$result123 = mysql_query ($query123) or mailerror(cron1);
}else{
exit();
}

// Delete unverified emails > 30 days
$past30days = date('Y-m-d', strtotime("-30 days"));
mysql_query("DELETE FROM subscribers WHERE joindate<='$past30days' and verified='0'") or mailerror(cron1a);

//Autoresponder script --------------------------------------------------------------------------------------------------------------------------------------------------

// select all autoresponder messages
$query="SELECT * FROM autoresponder";
$result=mysql_query ($query) or mailerror(cron2);

$totaladay=0;
while($line = mysql_fetch_array($result)) {
$aday = $line["aday"];
$subjectarray[$aday] = $line["asubject"];
$messagearray[$aday] = $line["amessage"];
$topadarray[$aday] = $line["topad"];
$bottomadarray[$aday] = $line["bottomad"];
if ($totaladay <= $aday) $totaladay = $aday;
}

// select emailads
$queryad = "SELECT * FROM emailad WHERE adstatus='on'";
$resultad = mysql_query ($queryad) or die ("Query failed");
$x=0;
while($rowad = mysql_fetch_array($resultad)) {
$x=$x+1;
$emailad[$x] = $rowad["admessage"];
}

$query = mysql_query("SELECT * FROM subscribers WHERE verified='1' ORDER BY ID") or mailerror(cron3);
while($row = mysql_fetch_array($query))
{
$id = $row['id'];
$aday = $row['nmailout'] + 1;
if ($aday <= $totaladay) {
if ($subjectarray[$aday]<>""){

$subjectnew = $subjectarray[$aday];
$messagenew = $messagearray[$aday];

$firstname = $row["firstname"];
$email = $row["email"];
$ip = $row["ip"];
$code = $row["code"];
$joindate = $row["joindate"];

//select 2 random emailad.
$a=range(1,$x);
shuffle($a);
$a1=$a ;
$a2=$a ;
if($topadarray[$aday]!="off") $topad = $emailad[$a1];
if ($bottomadarray[$aday]!="off") $bottomad = $emailad[$a2];

$subject = stripslashes($subjectnew);
$subject = str_replace("~firstname~", $firstname, $subject);

if($topadarray[$aday]!="off") $message = stripslashes($topad);
if($topadarray[$aday]!="off") $message .= "

";
$message .= stripslashes($messagenew);
$message = str_replace("~firstname~",$firstname,$message);
if ($bottomadarray[$aday]!="off") $message .= "

";
if ($bottomadarray[$aday]!="off") $message .= stripslashes($bottomad);
$message .= "

Re: Setting up a cron.php job using bravenet

SEE YOUR POST IN THE WEB DESIGN THREAD already open active topic there