<?php require dirname(__FILE__) . '/includes/bootstrap.php'; //If the user is not logged in, redirect to the index page if (!($userID = buckys_is_logged_in())) { buckys_redirect('/index.php'); } //Getting UserData from Id $userData = BuckysUser::getUserLinks($userID); if (isset($_POST['action'])) { //Check the user id is same with the current logged user id if ($_POST['userID'] != $userID) { echo 'Invalid Request!'; exit; } //Save Address if ($_POST['action'] == 'save_links') { $data = array(); for ($i = 0; $i < count($_POST['title']); $i++) { $data[] = array('title' => $_POST['title'][$i], 'url' => $_POST['url'][$i], 'visibility' => $_POST['visibility'][$i]); } //Update User Phone numbers if (BuckysUser::updateUserLinks($userID, $data)) { echo 'Success'; } else { echo $db->getLastError(); } exit; } } buckys_enqueue_stylesheet('account.css');
public function getLinkInfoAction() { $request = $_GET; $token = isset($request['TOKEN']) ? trim($request['TOKEN']) : null; if (!$token) { return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')]; } if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) { return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')]; } $linkInfo = BuckysUser::getUserLinks($userID); return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ['STATUS' => 'SUCCESS', 'RESULT' => $linkInfo]]; }