Esempio n. 1
0
function Channel(&$channelKey, $force = 0, $time = 1800)
{
    global $Channel, $db, $mastername;
    if ($force == 1) {
        @unlink(ONEZ_ROOT . './onezdata/cache/channel/' . $channelKey . '.php');
    }
    if (!$channelKey || time() - @filemtime(ONEZ_ROOT . './onezdata/cache/channel/' . $channelKey . '.php') > $time) {
        if (!$db) {
            include_once ONEZ_ROOT . './include/db_mysql.class.php';
            db_local();
            $db = new onez_db();
        }
        $Table = $db->record("channel", "*", "id='{$channelKey}'", 1);
        if (!$Table) {
            $Table = $db->record("channel", "*", "ifdefault=1", 1);
            if (!$Table) {
                $arr = array('name' => '官方默认群', 'username' => $mastername, 'level' => '-1', 'maxusr' => '-1', 'allowguest' => '0', 'forumid' => '0', 'forumname' => '', 'addtime' => time(), 'exptime' => '-1', 'ifdefault' => '1', 'ifonly' => '0', 'notice' => '', 'theme' => 'QQ2009');
                $db->insert("channel", $arr);
                $Table = $db->record("channel", "*", "ifdefault=1", 1);
            }
        }
        $Channel = $Table[0];
        $Channel['links'] = $db->record("links", "adpos,icon,title,linkurl", "(endtime<1 or endtime>" . time() . ") and cid='{$Channel['id']}' order by id desc");
        $channelKey = $Channel['id'];
        if (!$channelKey) {
            exit('INIT ERROR!');
        }
        mkdirs(ONEZ_ROOT . './onezdata/cache/channel');
        writeover(ONEZ_ROOT . './onezdata/cache/channel/' . $channelKey . '.php', '<?php
  $Channel=' . var_export($Channel, true) . ';
  ?>');
    } else {
        include ONEZ_ROOT . './onezdata/cache/channel/' . $channelKey . '.php';
    }
}
Esempio n. 2
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';
}
Esempio n. 3
0
    }
} elseif ($action == 'synlogout') {
    //同步退出
    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);