Код:
public function checkcc(){
$modal = new Modals();
$reponse = array();
$id = $this->input->post('id');
if(is_numeric($id) && !empty($id)){
if(is_numeric($this->session->userdata('id'))){
$this->load->helper('settings_helper');
$setSettings = new theSettings();
$data = $setSettings->fetchSettings();
$checkprice = $data["settings_cccheckprice"];
$this->load->model('balance_model');
$Results = $this->cards_model->SpecificGetBoobByIdTocheck('cards',$id);
if($Results == true){
foreach ($Results as $row) {
$ccnumber = $row->card_number;
$cvv = $row->card_cvv;
$exp = $row->card_expdate;
$selledon = $row->card_selledon;
$selledon = $row->card_selledon;
$cardPrices = $row->card_price;
$cardseller = $row->card_seller;
}
$nowdate = date('Y-m-d h:i:s');
$purshaseDate = date_create($selledon);
$nowdates = date_create($nowdate);
$diffs = date_diff($purshaseDate,$nowdates);
$diff = $diffs->format("%i");
if($diff <= $data['settings_ccchecktime']){
$userActualBalancer = $this->balance_model->VerifyBalance();
foreach ($userActualBalancer as $row) {
$userBalances = $row->balance;
}
if($userBalances >= $checkprice){
$updatedBalnce = (float)$userBalances - (float)$checkprice;
$Resupdatebalance = $this->balance_model->updatebalance($this->session->userdata('id'), $updatedBalnce);
$this->session->set_userdata( 'balance', $updatedBalnce );
if($Resupdatebalance == true){
$expdate = explode('/', $exp);
$expm = $expdate[0];
$expy = $expdate[1];
$lenth = strlen($expy);
if($lenth == 4){
$expy = substr($expy, 2,3);
}
$apikey = $data["settings_authstuff"];
$acct_Username = $data["settings_authstuffuser"];
$apiurl = 'https://mirror1.luxchecker.vc/apiv2/ck.php?cardnum='.$ccnumber.'&expm='.$expm.'&expy='.$expy.'&cvv='.$cvv.'&key='.$apikey.'&username='.$acct_Username;
$request = file_get_contents($apiurl);
$request = json_decode($request, true);
$cardresult = $request["auth_message"];
if ($cardresult != "Declined") {
$alert = '<b>This card is working.</b><br/> <br/>';
$alert .= '<button type="reset" class="btn btn-light" style="margin-right:15px;" data-dismiss="modal">Close</button>';
$reponse['nboob'] = $this->security->get_csrf_token_name();
$reponse['tboob'] = $this->security->get_csrf_hash();
$reponse['alert'] = $modal->CreateModal('bg-green', 'Success !', $alert);
$Results = $this->cards_model->Updatechecked('cards',array(
'card_checked'=>'1'
));
echo json_encode($reponse);
exit();
}
else if ($cardresult =="Declined") {
$userActualBalancer = $this->balance_model->VerifyBalance();
foreach ($userActualBalancer as $row) {
$userBalances = $row->balance;
}
$Refundedbalance = (float)$userBalances + (float)$cardPrices;
$Resupdatebalance = $this->balance_model->updatebalance($this->session->userdata('id'), $Refundedbalance);
$this->session->set_userdata( 'balance', $Refundedbalance );
if($Resupdatebalance == true){
$Results = $this->cards_model->updaterefundauto($id);
if($Results !== false){
$Results = $this->cards_model->getselleractualbalance($cardseller);
if($Results !== false ){
foreach ($Results as $row) {
$sellernowbalance = $row->sellerbalance;
}
}
$finalsellerbalance = (float)$sellernowbalance - (float)$cardPrices;
$Results = $this->cards_model->updatesellerbalance($cardseller, $finalsellerbalance);
$alert = '<b>Card not working, Object refunded.</b><br/> <br/>';
$alert .= '<button type="reset" class="btn btn-light" style="margin-right:15px;" data-dismiss="modal">Close</button>';
$reponse['nboob'] = $this->security->get_csrf_token_name();
$reponse['tboob'] = $this->security->get_csrf_hash();
$reponse['alert'] = $modal->CreateModal('bg-red', 'Error !', $alert);
$Results = $this->cards_model->Updatechecked('cards',array(
'card_checked'=>'1'
));
echo json_encode($reponse);
exit();
}
else {
$alert = '<b>An eroor hase been detected.</b><br/> <br/>';
$alert .= '<button type="reset" class="btn btn-light" style="margin-right:15px;" data-dismiss="modal">Close</button>';
$reponse['nboob'] = $this->security->get_csrf_token_name();
$reponse['tboob'] = $this->security->get_csrf_hash();
$reponse['alert'] = $modal->CreateModal('bg-red', 'Error !', $alert);
echo json_encode($reponse);
exit();
}
}
else {
$alert = '<b>An eroor hase been detected. ER001</b><br/> <br/>';
$alert .= '<button type="reset" class="btn btn-light" style="margin-right:15px;" data-dismiss="modal">Close</button>';
$reponse['nboob'] = $this->security->get_csrf_token_name();
$reponse['tboob'] = $this->security->get_csrf_hash();
$reponse['alert'] = $modal->CreateModal('bg-red', 'Error !', $alert);
echo json_encode($reponse);
exit();
}
}
}
else {
$alert = '<b>An eroor hase been detected. ER002</b><br/> <br/>';
$alert .= '<button type="reset" class="btn btn-light" style="margin-right:15px;" data-dismiss="modal">Close</button>';
$reponse['nboob'] = $this->security->get_csrf_token_name();
$reponse['tboob'] = $this->security->get_csrf_hash();
$reponse['alert'] = $modal->CreateModal('bg-red', 'Error !', $alert);
echo json_encode($reponse);
exit();
}
}
else {
$alert = '<b>Your balance have no money to cover the check costs</b><br/> <br/>';
$alert .= '<button type="reset" class="btn btn-light" style="margin-right:15px;" data-dismiss="modal">Close</button>';
$reponse['nboob'] = $this->security->get_csrf_token_name();
$reponse['tboob'] = $this->security->get_csrf_hash();
$reponse['alert'] = $modal->CreateModal('bg-red', 'Error !', $alert);
echo json_encode($reponse);
exit();
}
}
else {
$alert = '<b>Check Time Out.</b><br/> <br/>';
$alert .= '<button type="reset" class="btn btn-light" style="margin-right:15px;" data-dismiss="modal">Close</button>';
$reponse['nboob'] = $this->security->get_csrf_token_name();
$reponse['tboob'] = $this->security->get_csrf_hash();
$reponse['alert'] = $modal->CreateModal('bg-red', 'Error !', $alert);
echo json_encode($reponse);
exit();
}
В чем косяк? При проверке карты, происходит бесконечная загрузка