Beispiel #1
0
}
if (isset($_SESSION['token'])) {
    $client->setAccessToken($_SESSION['token']);
}
if (isset($_REQUEST['logout'])) {
    unset($_SESSION['token']);
    $client->revokeToken();
}
if ($client->getAccessToken()) {
    $user = $oauth2->userinfo->get();
    // These fields are currently filtered through the PHP sanitize filters.
    // See http://www.php.net/manual/en/filter.filters.sanitize.php
    $email = filter_var($user['email'], FILTER_SANITIZE_EMAIL);
    $img = filter_var($user['picture'], FILTER_VALIDATE_URL);
    include "../../../../classes/Model/MUserRegistration.php";
    $obj = new Model_MUserRegistration();
    $obj->googleautoRegister($user);
    header("Location:google_success.php");
    $personMarkup = "{$email}<div><img src='{$img}?sz=50'></div>";
    // The access token may have been updated lazily.
    $_SESSION['token'] = $client->getAccessToken();
} else {
    $authUrl = $client->createAuthUrl();
}
?>
<!doctype html>
<html>
<head><meta charset="utf-8"></head>
<body>
<header><h1>Google UserInfo Sample App</h1></header>
<?php 
Beispiel #2
0
    $content = str_replace('<p>', '<p class="content">', $content);
    $content = str_replace('<li>', '<li class="content">', $content);
    echo $content;
    ?>
</p>
                <p class="bottom">
              <a href="javascript:void(0);" class="accept_bg" onClick="fbAccept();">Accept</a>
                <a href="javascript:void(0);" class="cancel_bg" onClick="fbCancel();">Cancel</a>
            </p>
        </div>
    </div>

<?php 
} else {
    include "../../../classes/Model/MUserRegistration.php";
    $obj = new Model_MUserRegistration();
    $obj->autoRegister($user_profile);
    header("Location:facebook_success.php");
}
?>

</body>
</html>

<script type="text/javascript">
function fbAccept()
{
   window.location.href = '<?php 
echo $loginUrl;
?>
';