<?php 

set_time_limit(0);

date_default_timezone_set('Asia/Dubai');

$cron_time = @file_get_contents('orders_cron_time') ?? 0;

if(!isset($_GET['token']) || @$_GET['token']!= 4545155555512212 || time()<$cron_time+250 ){
  //error_log('wrong token');
  if(!isset($_REQUEST['test'])){
       exit;
  }
 
}


 if(!isset($_REQUEST['test'])){
error_log('orders cron start');

file_put_contents('orders_cron_time',time());

}




require_once __DIR__.'/lib/autoload.php';
require_once __DIR__.'/system/update_funds.php';

use PHPMailer\PHPMailer\PHPMailer;
$mail = new PHPMailer;



/*********************************************/
//glycon_check(DINAMICLISANCE, LISANCE_URL, 10);


  


  //crons statusu aktif olan cronları çektik
  $CRON_GUVENLIK = true;



 include('site_orders.php');
        
        $update = $conn->prepare("UPDATE crons SET cron_date_update=:date WHERE cron_id=:cron_id ");
        $update->execute(array("cron_id"=>2,"date"=>date("Y.m.d H:i:s") ));
      
        if($update){
            $cronname = 'Site Orders';
            $report = $conn->prepare("INSERT INTO crons_report SET crons_service_name=:crons_service_name, crons_detail=:crons_detail ");
            $report = $report->execute(array("crons_service_name"=>$cronname, "crons_detail"=>$cronname." cron ".date("d.m.Y H:i:s"). " was run on." ));
        }
  
   if(!isset($_REQUEST['test'])){
       
error_log('orders cron end');

}
?>          