Файл: payment/cron.php
Строк: 16
<?php
require ($_SERVER['DOCUMENT_ROOT'].'/core/sys.php');
$all = $db->prepare("SELECT * FROM `pay` WHERE `status` = 'bad' ORDER BY `id` DESC LIMIT 10");
$all -> execute();
$all = $all -> fetchAll();
foreach($all as $pay){
$client = $db->prepare('SELECT * FROM `platform` WHERE `id` = ?');
$client -> execute([$pay['platform']]);
$client = $client -> fetch(PDO :: FETCH_ASSOC);
$id = $pay['id'];
$moneys = $pay['summa'];
$time = vremja($pay['time']);
/*Присваиваем статус */
$sql = $db->prepare('UPDATE `pay` SET `status` = ?,`ot` = ? WHERE `id` = ?');
$sql -> execute(['yes',$out,$id]);
/*Ниже уберем если что....*/
if( $curl = curl_init() ) {
curl_setopt($curl, CURLOPT_URL, $client['success']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, "MNM_PAY_ID={$id}&MNM_PRICE={$moneys}&MNM_VAR={$pay['var']}&MNM_DATE_PAY={$time}&MNM_PLATFORM={$client['id']}&MNM_COM={$pay['com']}");
$out = curl_exec($curl);
curl_close($curl);
}
if($out == 'NO'){
$sql = $db->prepare('UPDATE `pay` SET `status` = ?,`ot` = ? WHERE `id` = ?');
$sql -> execute(['bad',$out,$id]);
exit();
}else{
$sql = $db->prepare('UPDATE `pay` SET `status` = ?, `ot` = ? WHERE `id` = ?');
$sql -> execute([$out,'yes',$id]);
}
$money = $db->prepare('UPDATE `platform` SET `money` = `money` + ? WHERE `id` = ?');
$money -> execute([$pay['summa'],$client['id']]);
print_r($ot);
}