Ejemplo n.º 1
0
function API_Login($user, $pass)
{
    global $db, $onlineip;
    include_once ONEZ_ROOT . './uc_client/client.php';
    $api = uc_user_login($user, $pass, 0);
    list($uid, $username, $password, $email) = $api;
    if ($uid < 0) {
        if ($uid == -1) {
            return '用户不存在,或者被删除';
        } elseif ($uid == -2) {
            return '用户名或密码不正确';
        } elseif ($uid == -3) {
            return '安全提问错';
        }
    }
    if (!$db) {
        include_once ONEZ_ROOT . './include/db_mysql.class.php';
        db_local();
        $db = new onez_db();
    }
    $db->reset();
    if ($db->rows("users", "uid='{$uid}'") == 0) {
        //创建本地用户
        if ($data = uc_get_user($uid, 1)) {
            list($uid, $username, $email) = $data;
            $arr = array('uid' => $uid, 'username' => $username, 'password' => md5($pass), 'email' => $email, 'infoip' => $onlineip, 'infotime' => time());
            $db->insert('users', $arr);
        }
    }
    $GLOBALS['cookiepre'] = 'onez_';
    osetcookie('userid', $uid, 31536000);
    osetcookie('username', $username, 31536000);
    echo uc_user_synlogin($uid);
    echo <<<ONEZ
<p align="center"><br /><br /><br /><br />
<a href="#" onclick="ReLoad()"><font size="2" color="#0000ff">正在同步登录中...</font></a>
</p>
<script type="text/javascript">
function ReLoad(){
  top.location.reload();
}
window.onload=ReLoad;
</script>
ONEZ;
    exit;
    return 'Y';
}
Ejemplo n.º 2
0
    require_once '../include/common.inc.php';
    $GLOBALS['cookiepre'] = 'onez_';
    osetcookie('userid', '', -86400);
    osetcookie('username', '', -86400);
    exit(API_RETURN_SUCCEED);
} elseif ($action == 'synlogin') {
    //同步登陆
    require_once '../include/common.inc.php';
    $uid = $get['uid'];
    $username = $get['username'];
    if (!$db) {
        include_once ONEZ_ROOT . './include/db_mysql.class.php';
        db_local();
        $db = new onez_db();
    }
    if ($db->rows("users", "uid='{$uid}'") == 0) {
        //创建本地用户
        include_once '../uc_client/client.php';
        if ($data = uc_get_user($uid, 1)) {
            list($uid, $username, $email) = $data;
            $arr = array('uid' => $uid, 'username' => $username, 'email' => $email, 'infoip' => $onlineip, 'infotime' => $time);
            $db->insert('users', $arr);
        }
    }
    $GLOBALS['cookiepre'] = 'onez_';
    osetcookie('userid', $uid, 31536000);
    osetcookie('username', $username, 31536000);
    exit(API_RETURN_SUCCEED);
} elseif ($action == 'getcreditsettings') {
    //发送积分配置
    require_once '../include/common.inc.php';