} echo "</table><br/><br/>"; } ?> </div> <div> <?php if (isset($_POST["view_btn"])) { if (isset($_POST['hiddenI'])) { $image = $_POST['hiddenI']; } echo "<table><tr><th><b>Image Section</b></th></tr></table><br/>"; echo "<img height='50%' width='50%' src='" . $dropbox->GetLink($image, false) . "'/><br/>"; } elseif (isset($_POST["delete_btn"])) { if (isset($_POST['hiddenF'])) { $fileD = $_POST['hiddenF']; } $dropbox->Delete($fileD); $delete_file = $target_dir . basename($fileD); if (!unlink($delete_file)) { $message = 0; } else { $message = 1; } header("Location: album.php?msg={$message}"); } ?> </div> </body> </html>
// get & store access token, the request token is not needed anymore $access_token = $dropbox->GetAccessToken($request_token); store_token($access_token, "access"); delete_token($_GET['oauth_token']); } // checks if access token is required if (!$dropbox->IsAuthorized()) { // redirect user to dropbox auth page $return_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . "?auth_callback=1"; $auth_url = $dropbox->BuildAuthorizeUrl($return_url); $request_token = $dropbox->GetRequestToken(); store_token($request_token, $request_token['t']); die("Authentication required. <a href='{$auth_url}'>Click here.</a>"); } // CODE# $dropbox->Delete($_GET['dbxPath']); function store_token($token, $name) { if (!file_put_contents("tokens/{$name}.token", serialize($token))) { die('<br />Could not store token! <b>Make sure that the directory `tokens` exists and is writable!</b>'); } } function load_token($name) { if (!file_exists("tokens/{$name}.token")) { return null; } return @unserialize(@file_get_contents("tokens/{$name}.token")); } function delete_token($name) {