<?php

require_once '../EZAppDotNet.php';
$app = new EZAppDotNet();
// log out user
$app->deleteSession();
// redirect user after logging out
header('Location: index.php');
<?php

require_once '../EZAppDotNet.php';
$app = new EZAppDotNet();
// log in user
// if 'Remember me' was checked...
if (isset($_SESSION['rem'])) {
    // pass 1 into setSession in order
    // to set a cookie and session
    $token = $app->setSession(1);
} else {
    // otherwise just set session
    $token = $app->setSession();
}
// redirect user after logging in
header('Location: index.php');
Exemplo n.º 3
0
<?php

// checking if the 'Remember me' checkbox was clicked
if (isset($_GET['rem'])) {
    session_start();
    if ($_GET['rem'] == '1') {
        $_SESSION['rem'] = 1;
    } else {
        unset($_SESSION['rem']);
    }
    header('Location: index.php');
}
require_once '../EZAppDotNet.php';
$app = new EZAppDotNet();
// check that the user is signed in
if ($app->getSession()) {
    // get the current user as JSON
    $data = $app->getUser();
    // accessing the user's cover image
    echo '<body style="background:url(' . $data['cover_image']['url'] . ')">';
    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>";