I have purchased a ad manager type script and have put so much work in to the site but i cannot get the cron file to execute properly due to errors. The makers of the script arent answering my emails so I am left to find the answer myself im hoping some experts can shine a light on this for me
I have the cron running once daily as required
the error messages are as follows:
/home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 1: ?php: No such file or directory /home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: syntax error near unexpected token `;' /home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: `ob_start();'
I have installed the script on two different hosts and get the exact same errors.
any help would be much appriciated
the contents of the cron file are below
______________________________________________
<?php
ob_start();
ini_set("max_execution_time", 0);
error_reporting(0);
require_once("db_connection.php");
// hits table fix
$ws = mysql_query("select pid from publishersinfo");
while($row = mysql_fetch_assoc($ws)){
$max = mysql_fetch_assoc(mysql_query("SELECT count(distinct ip) as distinct_hits, count(ip) as hits, date from hits where pub_id='$row[pid]' group by date order by hits desc, distinct_hits desc limit 1"));
mysql_query("update publishersinfo set hits = '$max[hits]', distinct_hits = '$max[distinct_hits]' where pid = '$row[pid]' ");
$country_clicks = mysql_query("select count(country) as clicks, country from hits where is_click = 1 and pub_id = '$row[pid]' GROUP BY country order by clicks desc");
mysql_query("delete from country_clicks where pid = '$row[pid]' ");
while($rc = mysql_fetch_assoc($country_clicks)){
mysql_query("insert into country_clicks set clicks = '$rc[clicks]' , country = '$rc[country]', pid = '$row[pid]', updated = CURDATE() ");
}
}
mysql_free_result($ws);
// adv info
$advertisement_ids = mysql_query("select adv_id from advertisersinfo");
while($ro = mysql_fetch_assoc($advertisement_ids)){
$clicksToday = mysql_result(mysql_query("select count(hit_id) from hits where adv_id = '$ro[adv_id]' and is_click='1' and is_sale='0' and `date` = CURDATE()"),0,0);
$impressionsToday = mysql_result(mysql_query("select count(hit_id) from hits where adv_id = '$ro[adv_id]' and is_click='0' and is_sale='0' and `date` = CURDATE()"),0,0);
$conversionsToday = mysql_result(mysql_query("select count(hit_id) from hits where adv_id = '$ro[adv_id]' and is_sale='1' and `date` = CURDATE()"),0,0);
mysql_query("update advertisersinfo set clicksToday = $clicksToday, clicksTotal = (clicksTotal + $clicksToday), impressionsToday = $impressionsToday, impressionsTotal = (impressionsTotal + $impressionsToday), conversionsTotal = (conversionsTotal + $conversionsToday) where adv_id = '$ro[adv_id]' ");
}
mysql_free_result($advertisement_ids);
// targeted_ads
$cmp_ids = mysql_query("select cmp_id from adv_campaign");
while($ro = mysql_fetch_assoc($cmp_ids)){
$clicksToday = mysql_result(mysql_query("select count(hit_id) from hits where cmp_id = '$ro[cmp_id]' and is_click='1' and `date` = CURDATE()"),0,0);
mysql_query("update adv_campaign set clicksToday = $clicksToday, clicksTotal = (clicksTotal + $clicksToday), remaining_budget = (remaining_budget - expense_today) where cmp_id = '$ro[cmp_id]' ");
//camp_appeared
$camp_appeared = mysql_query("select distinct publishersinfo.url, publishersinfo.pid from publishersinfo, hits where hits.cmp_id= '$ro[cmp_id]' and hits.pub_id=publishersinfo.pid order by hits.hit_id, hits.pub_id");
mysql_query("delete from camp_appeared where cmp_id= '$ro[cmp_id]' ");
while($cmp = mysql_fetch_assoc($camp_appeared)){
mysql_query(" insert into camp_appeared set url = '$cmp', pid = '$cmp[pid]', cmp_id = '$ro[cmp_id]', updated = curdate() ");
}
}
mysql_free_result($cmp_ids);
/*
$as = mysql_query("select ad_id from publishers_adspaces");
while($row = @mysql_fetch_assoc($as)){
$max_one_day_clicks = mysql_result(mysql_query("SELECT count(hit_id) as total from hits where is_click=1 and ad_id='$row[ad_id]' group by date order by total desc limit 1"),0,0);
mysql_query("update publishers_adspaces set hits = $max_one_day_clicks ");
}
mysql_free_result($as);
*/
$users = mysql_query(" select uid from users where utype = 'pub+adv' ");
while($r = mysql_fetch_assoc($users)){
$price = mysql_result(mysql_query("select sum(h.click_price) as price
from publishersinfo pi inner join hits h on pi.pid = h.pub_id
where pi.uid = '$r[uid]' and h.cmp_id <> 0 and h.date=curdate() and h.is_click=1
"),0,0);
mysql_query("delete from pub_earningstoday where uid = '$r[uid]' ");
mysql_query("insert into pub_earningstoday set updated = CURDATE(), uid = '$r[uid]', price = '$price' ");
}
?>