$deal_id = $_POST['deal_id']; } $user_id = 0; if (!empty($_POST['user_id'])) { $user_id = $_POST['user_id']; } $login_hash = ""; if (!empty($_POST['login_hash'])) { $login_hash = $_POST['login_hash']; } $api_key = ""; if (!empty($_POST['api_key'])) { $api_key = $_POST['api_key']; } if (!$controllerUser->isUserIdExistAndHash($user_id, $login_hash) || Constants::API_KEY != $api_key) { $jsonArray = array(); $jsonArray['status'] = array('status_code' => "3", 'status_text' => "Invalid Access. Please relogin."); echo json_encode($jsonArray); } else { if ($deal_id > 0) { $controllerDeal->deleteDeal($deal_id, 1); $jsonArray = array(); $jsonArray['status'] = array('status_code' => "-1", 'status_text' => "Success."); $jsonArray['deal'] = array('deal_id' => $deal_id); echo json_encode($jsonArray); } else { $jsonArray = array(); $jsonArray['status'] = array('status_code' => "3", 'status_text' => "Invalid Access. Please relogin."); echo json_encode($jsonArray); } }
function deleteDeal($deal_id, $landing_page) { $ControllerDeal = new ControllerDeal(); $ControllerDeal->deleteDeal($deal_id, 1); echo "<script type='text/javascript'>location.href='{$landing_page}';</script>"; }