예제 #1
0
파일: index.php 프로젝트: ZoomsX1/Php6INFO
    session_start();
    session_destroy();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    session_start();
    include "openid.php";
    function base64url_decode($base64url)
    {
        $base64 = strtr($base64url, '-_', '+/');
        $plainText = base64_decode($base64);
        return $plainText;
    }
    $openid = new LightOpenID('mds.go-ao.eu');
    if ($openid->mode) {
        //        echo $openid->validate() ? 'Logged in.' : 'Failed';
        echo $openid->__get("identity");
        $attributes = $openid->getAttributes();
        $encodedPhoto = $attributes['eid/photo'];
        $photo = base64url_decode($encodedPhoto);
        $_SESSION['foto'] = $photo;
        $_SESSION['naam'] = $attributes['namePerson'];
        $_SESSION['gebdat'] = $attributes['birthDate'];
        $_SESSION['straat'] = $attributes['contact/postalAddress/home'];
        $_SESSION['postc'] = $attributes['contact/postalCode/home'];
        $_SESSION['woonpl'] = $attributes['contact/city/home'];
        $_SESSION['geslacht'] = $attributes['person/gender'];
        $_SESSION['kaartnr'] = $attributes['eid/card-number'];
        $_SESSION['nat'] = $attributes['eid/nationality'];
        $_SESSION['pob'] = $attributes['eid/pob'];
        $_SESSION['logged_in'] = true;
        header('Location: beveiligd.php');
예제 #2
0
    }
    return "";
}
try {
    if (!isset($_GET['openid_mode'])) {
        if (isset($_GET['login'])) {
            $openid = new LightOpenID();
            switch ($_GET["provider"]) {
                case "steam":
                    $openid->identity = 'https://steamcommunity.com/openid/';
                    break;
                default:
                    // google
                    $openid->identity = 'https://www.google.com/accounts/o8/id';
                    $openid->required = array('contact/email');
            }
            header('Location: ' . $openid->authUrl());
        }
    } elseif ($_GET['openid_mode'] == 'cancel') {
        session_destroy();
        echo 'User has canceled authentication!';
    } else {
        $openid = new LightOpenID();
        if ($openid->validate() && $openid->identity) {
            $userinfo = $openid->getAttributes();
            $_SESSION['user_login'] = isset($userinfo['contact/email']) ? $userinfo['contact/email'] : $openid->__get("identity");
        }
    }
} catch (ErrorException $e) {
    echo $e->getMessage();
}