} $full_name = ""; if (!empty($_POST['full_name'])) { $full_name = $_POST['full_name']; } $email = ""; if (!empty($_POST['email'])) { $email = $_POST['email']; } $user_id = ""; if (!empty($_POST['user_id'])) { $user_id = $_POST['user_id']; } $login_hash = ""; if (!empty($_POST['login_hash'])) { $login_hash = $_POST['login_hash']; } if (!$controllerUser->isUserIdExistAndHash($user_id, $login_hash)) { $json = "{ \"status\" : { \"status_code\" : \"3\", \"status_text\" : \"Invalid Access\" } }"; echo $json; } else { $itm = $controllerUser->getUserByUserId($user_id); if ($itm != null) { $itm->full_name = $full_name; $itm->password = $password; $controllerUser->updateUserNameAndPassword($itm); $itm = $controllerUser->getUserByUserId($user_id); $json = "{ \"user_info\" : { \"user_id\" : \"{$itm->user_id}\", \"username\" : \"{$itm->username}\", \"login_hash\" : \"{$itm->login_hash}\", \"facebook_id\" : \"{$itm->facebook_id}\", \"twitter_id\" : \"{$itm->twitter_id}\", \"full_name\" : \"{$itm->full_name}\", \"thumb_url\" : \"{$itm->thumb_url}\", \"photo_url\" : \"{$itm->photo_url}\", \"email\" : \"{$itm->email}\"}, \"status\" : { \"status_code\" : \"-1\", \"status_text\" : \"Success.\" } }"; echo $json; } }
if (!empty($_POST['deal_id'])) { $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); }