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
if ($Channel['maxusr'] != -1 && Online($channelid) >= $Channel['maxusr']) {
    API_Logout();
    exit('<script>alert("本群人数已满");
  if(top!==self)top.location.reload();</script>');
}
$today = date('Ymd');
if ($Channel['forumid'] && $Channel['lastday'] != $today) {
    $api = API_Pub($bbsTitle, $bbsContent);
    list($tid, $url) = $api;
    $arr = array('lasttid' => $tid, 'lastday' => $today);
    if (!$db) {
        include_once ONEZ_ROOT . './include/db_mysql.class.php';
        db_local();
        $db = new onez_db();
    }
    $db->reset();
    $db->update("channel", $arr, "id='{$Channel['id']}'");
    if ($Conn) {
        $Conn->reset();
    }
    @unlink('onezdata/cache/channel/' . $Channel['id'] . '.php');
}
if ($Channel['username'] == $username) {
    $grade = 28;
} elseif (in_array($username, explode(',', $Channel['masters']))) {
    $grade = 2;
} elseif ($username) {
    $grade = 1;
} else {
    if ($Channel['allowguest'] == 1) {
        $grade = 0;