clientID, "clientsecret" => clientsecret), JSON_UNESCAPED_UNICODE); $responses = ioAPIv2('/v2/authorization', $data,''); //Decode Payload if (!empty($responses)){$responses = json_decode($responses,true);}else{$responses = '400';} $clientsecret = $responses['token']; // If the user is not logged-in redirect them to the login page if (!isset($_SESSION['account_loggedin'])) { header('Location: ' . url('../index.php?page=myaccount')); exit; } // If the user is not admin redirect them back to the shopping cart home page $stmt = $pdo->prepare('SELECT * FROM accounts WHERE id = ?'); $stmt->execute([ $_SESSION['account_id'] ]); $account = $stmt->fetch(PDO::FETCH_ASSOC); if (!$account || $account['role'] != 'Admin') { header('Location: ' . url('../index.php')); exit; } // Page is set to home (home.php) by default, so when the visitor visits that will be the page they see. $page = isset($_GET['page']) && file_exists($_GET['page'] . '.php') ? $_GET['page'] : 'settings'; if (isset($_GET['page']) && $_GET['page'] == 'logout') { session_destroy(); header('Location: ' . url('../index.php')); exit; } // Output error variable $error = ''; // Include the requested page include $page . '.php'; ?>