-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathindex.php
More file actions
34 lines (31 loc) · 995 Bytes
/
index.php
File metadata and controls
34 lines (31 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require_once "bootstrap.php";
if (!isset($access_token)) {
header("Location: ./authorize.php");
exit;
}
try {
// Start a new Dropbox session
$session = new DropboxSession(
$config["dropbox"]["app_key"],
$config["dropbox"]["app_secret"],
$config["dropbox"]["access_type"],
$access_token
);
$client = new DropboxClient($session);
// Retrieve account info
if ($info = $client->accountInfo()) {
echo "<p>Account Details for User <strong>" . $info["display_name"] . "</strong> - ";
echo '<a href="list.php">View Files</a></p>';
echo "<pre>" . print_r($info, true) . "</pre>";
}
}
catch (Exception $e) {
echo "<strong>ERROR (" . $e->getCode() . ")</strong>: " . $e->getMessage();
if ($e->getCode() == 401) {
// Remove auth file
unlink($config["app"]["authfile"]);
// Re auth
echo '<p><a href="authorize.php">Click Here to re-authenticate</a></p>';
}
}