hi,
Our eximstats_db has been converted to sqlite database after our WHM upgrade, and new version is 64.0.19. We are using eximstas_db for cron job purpose in our server and we are new with SQLite . we have tried many more times to access this database using php codes . But no result is found . While run the code a new db creating in the same folder it self . How can i solve this problem ? . And attaching the code that used .
is there any change in this code ? how can i remove the errors?
Best Regards,
Sarangi Tech Solutions
Our eximstats_db has been converted to sqlite database after our WHM upgrade, and new version is 64.0.19. We are using eximstas_db for cron job purpose in our server and we are new with SQLite . we have tried many more times to access this database using php codes . But no result is found . While run the code a new db creating in the same folder it self . How can i solve this problem ? . And attaching the code that used .
Code:
class MyDB extends SQLite3
{
function __construct()
{
$this->open('/var/cpanel/eximstats_db.sqlite3');
}
}
$db = new MyDB();
if(!$db){
echo $db->lastErrorMsg();
} else {
echo "Opened database successfully\n";
date_default_timezone_set('Asia/Kuwait');
$time= date("Y-m-d H:i:s");
$date = new DateTime(date("Y-m-d H:i:s"));
$date->modify('-600 seconds');
$intervel=$date->format('Y-m-d H:i:s');
$query1 = '(SELECT mailtime FROM failures WHERE ip!="127.0.0.1" AND mailtime BETWEEN "$intervel" AND "$time" ) UNION ALL (SELECT mailtime FROM defers WHERE ip!="127.0.0.1" AND mailtime BETWEEN "$intervel" AND "$time")';
$result = $db->query($query1);
$count=count($result);
echo $count;
if($count>20){
$qry="(SELECT email, COUNT( * ) c FROM failures WHERE ip!='127.0.0.1' AND mailtime BETWEEN '$intervel' AND '$time' GROUP BY email ORDER BY c DESC LIMIT 1)";
$qry2="(SELECT email, COUNT( * ) c FROM defers WHERE ip!='127.0.0.1' AND mailtime BETWEEN '$intervel' AND '$time' GROUP BY email ORDER BY c DESC LIMIT 1)";
$result21 = $db->query($qry);
$result45 = $db->query($qry2);
echo $intervel." to" .$time." count is= ".$count.' ';
while($row = $result21->fetchArray(SQLITE3_ASSOC) ){
echo "MOST COUNT failures :" . $row . " and count =" . $row[c] . " ";
$failemail=$row[email];
$failcount=$row[c];
}
while($row = $result45->fetchArray(SQLITE3_ASSOC) ){
echo "MOST COUNT failures :" . $row[email] . " and count =" . $row[c] . " ";
$failemail=$row[email];
$failcount=$row[c];
}
}
}
$db->close();
Best Regards,
Sarangi Tech Solutions
Last edited by a moderator: