Exemplo n.º 1
0
 echo '<div style="background:#fff;opacity:0.8;padding:20px;margin:10px;border-radius:15px;">';
 echo '<h1>Welcome to <a target="_blank" href="https://github.com/jdolitsky/AppDotNetPHP">';
 echo 'AppDotNetPHP</a> (the EZ version)</h1>';
 // accessing the user's name
 echo '<h3>' . $data['name'] . '</h3>';
 // accessing the user's avatar image
 echo '<img style="border:2px solid #000;" src="' . $data['avatar_image']['url'] . '" /><br>';
 // try posting to ADN
 if (isset($_POST['run_tests'])) {
     print "<hr />";
     print "<h3>Testing ADN functionality</h3>";
     print '<pre>';
     print '<b>Your access token is: </b>' . htmlspecialchars($app->setSession()) . "\n";
     $token = $app->setSession();
     print "<b>Clearing access token</b>\n";
     $app->setAccessToken(null);
     print "<b>Checking that we can no longer access app.net's API...</b>";
     print '<blockquote>';
     try {
         $denied = $app->getUser();
         print " error - we were granted access without a token?!?\n";
         exit;
     } catch (AppDotNetException $e) {
         if ($e->getCode() == 401) {
             print " success (could not get access)\n";
         } else {
             throw $e;
         }
     }
     print '</blockquote>';
     print "<b>Resetting access token</b>\n";