Esempio n. 1
0
                $db->query("UPDATE " . USERPREFIX . "_users SET foto='{$foto_name}' WHERE user_id='{$id}'");
            }
        }
    }
    echo str_replace("{text}", $lang['social_login_ok'] . $js_popup, $popup);
    die;
}
if (isset($_GET['code']) and $_GET['code'] and !$is_logged and $config['allow_social'] and $config['allow_registration']) {
    if (!$_SESSION['state'] or $_SESSION['state'] != $_GET['state']) {
        echo str_replace("{text}", $lang['reg_err_39'], $popup);
        die;
    }
    include_once ENGINE_DIR . '/data/socialconfig.php';
    include_once ENGINE_DIR . '/classes/social.class.php';
    $social = new SocialAuth($social_config);
    $social_user = $social->getuser();
    if (is_array($social_user)) {
        session_regenerate_id();
        $social_user['sid'] = $db->safesql($social_user['sid']);
        $row = $db->super_query("SELECT * FROM " . USERPREFIX . "_social_login WHERE sid='{$social_user['sid']}'");
        if ($row['id']) {
            if ($row['uid']) {
                $_TIME = time();
                $_IP = get_ip();
                $member_id = $db->super_query("SELECT * FROM " . USERPREFIX . "_users WHERE user_id='{$row['uid']}'");
                if ($member_id['user_id']) {
                    if ($row['wait']) {
                        register_wait_user($social_user, $member_id['user_id'], $member_id['name'], $member_id['email'], $row['id'], $row['password']);
                    }
                    set_cookie("dle_user_id", $member_id['user_id'], 365);
                    set_cookie("dle_password", $row['password'], 365);