コード例 #1
0
ファイル: logs.php プロジェクト: thu0ng91/jmc
 function addlog($data)
 {
     global $jieqiLsort;
     jieqi_getconfigs('system', 'lsort', 'jieqiLsort');
     if (empty($data) || !is_array($data)) {
         return false;
     }
     $newLogs =& $this->create();
     $logtype = isset($data['logtype']) ? intval($data['logtype']) : 0;
     $newLogs->setVar('logtype', $logtype);
     isset($data['siteid']) ? $newLogs->setVar('siteid', intval($data['siteid'])) : $newLogs->setVar('siteid', JIEQI_SITE_ID);
     isset($data['loglevel']) ? $newLogs->setVar('loglevel', intval($data['loglevel'])) : $newLogs->setVar('loglevel', intval($jieqiLsort[$logtype]['loglevel']));
     isset($data['logtime']) ? $newLogs->setVar('logtime', intval($data['logtime'])) : $newLogs->setVar('logtime', JIEQI_NOW_TIME);
     isset($data['userid']) ? $newLogs->setVar('userid', intval($data['userid'])) : $newLogs->setVar('userid', intval($_SESSION['jieqiUserId']));
     isset($data['username']) ? $newLogs->setVar('username', $data['username']) : $newLogs->setVar('username', $_SESSION['jieqiUserName']);
     isset($data['userip']) ? $newLogs->setVar('userip', $data['userip']) : $newLogs->setVar('userip', jieqi_userip());
     isset($data['targetname']) ? $newLogs->setVar('targetname', $data['targetname']) : $newLogs->setVar('targetname', $jieqiLsort[$logtype]['targetname']);
     isset($data['targetid']) ? $newLogs->setVar('targetid', intval($data['targetid'])) : $newLogs->setVar('targetid', 0);
     isset($data['targettitle']) ? $newLogs->setVar('targettitle', $data['targettitle']) : $newLogs->setVar('targettitle', '');
     isset($data['logurl']) ? $newLogs->setVar('logurl', $data['logurl']) : $newLogs->setVar('logurl', jieqi_addurlvars(array(), false, false));
     isset($data['logcode']) ? $newLogs->setVar('logcode', intval($data['logcode'])) : $newLogs->setVar('logcode', 0);
     isset($data['logtitle']) ? $newLogs->setVar('logtitle', $data['logtitle']) : $newLogs->setVar('logtitle', $jieqiLsort[$logtype]['logtitle']);
     isset($data['logdata']) ? $newLogs->setVar('logdata', $data['logdata']) : $newLogs->setVar('logdata', '');
     isset($data['lognote']) ? $newLogs->setVar('lognote', $data['lognote']) : $newLogs->setVar('lognote', '');
     isset($data['fromdata']) ? $newLogs->setVar('fromdata', $data['fromdata']) : $newLogs->setVar('fromdata', '');
     isset($data['todata']) ? $newLogs->setVar('todata', $data['todata']) : $newLogs->setVar('todata', '');
     return $this->insert($newLogs);
 }
コード例 #2
0
ファイル: funpost.php プロジェクト: thu0ng91/jmc
/**
 * 增加帖子
 * 
 * @param      array       $post_set 发帖信息设置
 * @param      object      $newPost 帖子实例
 * @access     public
 * @return     void
 */
function jieqi_post_newset(&$post_set, &$newPost)
{
    if (empty($_SESSION['jieqiUserId'])) {
        $tmpuid = 0;
        $tmpuname = '';
    } else {
        $tmpuid = $_SESSION['jieqiUserId'];
        $tmpuname = $_SESSION['jieqiUserName'];
    }
    $newPost->setVar('siteid', JIEQI_SITE_ID);
    $newPost->setVar('topicid', $post_set['topicid']);
    $istopic = isset($post_set['istopic']) ? $post_set['istopic'] : 0;
    $newPost->setVar('istopic', $istopic);
    $newPost->setVar('replypid', 0);
    $newPost->setVar('ownerid', $post_set['ownerid']);
    $newPost->setVar('posterid', $tmpuid);
    $newPost->setVar('poster', $tmpuname);
    $newPost->setVar('posttime', JIEQI_NOW_TIME);
    $newPost->setVar('posterip', jieqi_userip());
    $newPost->setVar('editorid', 0);
    $newPost->setVar('editor', '');
    $newPost->setVar('edittime', JIEQI_NOW_TIME);
    $newPost->setVar('editorip', '');
    $newPost->setVar('editnote', '');
    $newPost->setVar('iconid', 0);
    $newPost->setVar('attachment', $post_set['attachment']);
    $newPost->setVar('subject', $post_set['topictitle']);
    $newPost->setVar('posttext', $post_set['posttext']);
    $newPost->setVar('size', strlen($post_set['posttext']));
}
コード例 #3
0
ファイル: checklogin.php プロジェクト: thu0ng91/jmc
/**
 * 用户登录后处理
 * 
 * @param      object      $jieqiUsers 用户对象
 * @access     public
 * @return     bool
 */
function jieqi_loginprocess($jieqiUsers, $usecookie = 0)
{
    global $jieqiConfigs;
    global $jieqiHonors;
    global $jieqiGroups;
    if (!isset($jieqiConfigs['system'])) {
        jieqi_getconfigs('system', 'configs');
    }
    include_once JIEQI_ROOT_PATH . '/class/users.php';
    $users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler');
    //更新在线用户表
    include_once JIEQI_ROOT_PATH . '/class/online.php';
    $online_handler =& JieqiOnlineHandler::getInstance('JieqiOnlineHandler');
    $criteria = new CriteriaCompo(new Criteria('uid', $jieqiUsers->getVar('uid', 'n')));
    $criteria->setSort('updatetime');
    $criteria->setOrder('DESC');
    $online_handler->queryObjects($criteria);
    $online = $online_handler->getObject();
    //读cookie信息
    $jieqi_user_info = array();
    if (!empty($_COOKIE['jieqiUserInfo'])) {
        $jieqi_user_info = jieqi_strtosary($_COOKIE['jieqiUserInfo']);
    } else {
        $jieqi_user_info = array();
    }
    $jieqi_visit_info = array();
    if (!empty($_COOKIE['jieqiVisitInfo'])) {
        $jieqi_visit_info = jieqi_strtosary($_COOKIE['jieqiVisitInfo']);
    } else {
        $jieqi_visit_info = array();
    }
    if (is_object($online)) {
        $ip = jieqi_userip();
        if (JIEQI_SESSION_EXPRIE > 0) {
            $exprie_time = JIEQI_SESSION_EXPRIE;
        } else {
            $exprie_time = @ini_get('session.gc_maxlifetime');
        }
        if (empty($exprie_time)) {
            $exprie_time = 1800;
        }
        if (defined('JIEQI_DENY_RELOGIN') && JIEQI_DENY_RELOGIN == 1 && JIEQI_NOW_TIME - $online->getVar('updatetime') < $exprie_time && $online->getVar('ip', 'n') != $ip && $jieqi_visit_info['jieqiUserId'] != $jieqiUsers->getVar('uid')) {
            return -8;
        }
        $tmpvar = strlen($jieqiUsers->getVar('name', 'q')) > 0 ? $jieqiUsers->getVar('name', 'q') : $jieqiUsers->getVar('uname', 'q');
        $sql = "UPDATE " . jieqi_dbprefix('system_online') . " SET uid=" . $jieqiUsers->getVar('uid', 'q') . ", sid='" . jieqi_dbslashes(session_id()) . "', uname='" . $jieqiUsers->getVar('uname', 'q') . "', name='" . $tmpvar . "', pass='******'pass', 'q') . "',email='" . $jieqiUsers->getVar('email', 'q') . "', groupid=" . $jieqiUsers->getVar('groupid', 'q') . ", updatetime=" . JIEQI_NOW_TIME . ", ip='" . jieqi_dbslashes($ip) . "' WHERE uid=" . $jieqiUsers->getVar('uid', 'q') . " OR sid='" . jieqi_dbslashes(session_id()) . "'";
        $online_handler->db->query($sql);
    } else {
        include_once JIEQI_ROOT_PATH . '/include/visitorinfo.php';
        $online = $online_handler->create();
        $online->setVar('uid', $jieqiUsers->getVar('uid', 'n'));
        $online->setVar('siteid', JIEQI_SITE_ID);
        $online->setVar('sid', session_id());
        $online->setVar('uname', $jieqiUsers->getVar('uname', 'n'));
        $tmpvar = strlen($jieqiUsers->getVar('name', 'n')) > 0 ? $jieqiUsers->getVar('name', 'n') : $jieqiUsers->getVar('uname', 'n');
        $online->setVar('name', $tmpvar);
        $online->setVar('pass', $jieqiUsers->getVar('pass', 'n'));
        $online->setVar('email', $jieqiUsers->getVar('email', 'n'));
        $online->setVar('groupid', $jieqiUsers->getVar('groupid', 'n'));
        $tmpvar = JIEQI_NOW_TIME;
        $online->setVar('logintime', $tmpvar);
        $online->setVar('updatetime', $tmpvar);
        $online->setVar('operate', '');
        $tmpvar = VisitorInfo::getIp();
        $online->setVar('ip', $tmpvar);
        $online->setVar('browser', VisitorInfo::getBrowser());
        $online->setVar('os', VisitorInfo::getOS());
        $location = VisitorInfo::getIpLocation($tmpvar);
        if (JIEQI_SYSTEM_CHARSET == 'big5') {
            include_once JIEQI_ROOT_PATH . '/include/changecode.php';
            $location = jieqi_gb2big5($location);
        }
        $online->setVar('location', $location);
        $online->setVar('state', '0');
        $online->setVar('flag', '0');
        $online_handler->insert($online);
    }
    //删除过期的在线用户
    unset($criteria);
    $criteria = new CriteriaCompo(new Criteria('updatetime', JIEQI_NOW_TIME - $jieqiConfigs['system']['onlinetime'], '<'));
    $online_handler->delete($criteria);
    //检查短消息
    include_once JIEQI_ROOT_PATH . '/class/message.php';
    $message_handler = JieqiMessageHandler::getInstance('JieqiMessageHandler');
    $criteria = new CriteriaCompo(new Criteria('toid', $jieqiUsers->getVar('uid'), '='));
    $criteria->add(new Criteria('isread', 0, '='));
    $criteria->add(new Criteria('todel', 0, '='));
    $newmsgnum = $message_handler->getCount($criteria);
    unset($criteria);
    //有短消息
    //用户信息
    $previewlogin = intval($jieqiUsers->getVar('lastlogin'));
    $jieqiUsers->setVar('lastlogin', JIEQI_NOW_TIME);
    $userset = unserialize($jieqiUsers->getVar('setting', 'n'));
    if (!isset($userset['lastip']) || $userset['lastip'] != jieqi_userip()) {
        $userset['lastip'] = jieqi_userip();
    }
    if (!isset($userset['logindate']) || $userset['logindate'] != date('Y-m-d')) {
        $userset['logindate'] = date('Y-m-d');
        //增加登陆积分
        $jieqiUsers->setVar('experience', $jieqiUsers->getVar('experience') + $jieqiConfigs['system']['scorelogin']);
        $jieqiUsers->setVar('score', $jieqiUsers->getVar('score') + $jieqiConfigs['system']['scorelogin']);
    }
    //如果换月了,清空月积分
    //if(date('Y-m', $previewlogin) != date('Y-m', JIEQI_NOW_TIME)) $jieqiUsers->setVar('monthscore', 0);
    $jieqiUsers->setVar('setting', serialize($userset));
    $jieqiUsers->unsetNew();
    $users_handler->insert($jieqiUsers);
    header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
    //设置SESSION
    jieqi_setusersession($jieqiUsers);
    if ($newmsgnum > 0) {
        $_SESSION['jieqiNewMessage'] = $newmsgnum;
    }
    //后台登录状态
    $jieqi_online_info = empty($_COOKIE['jieqiOnlineInfo']) ? array() : jieqi_strtosary($_COOKIE['jieqiOnlineInfo']);
    if (isset($jieqi_online_info['jieqiAdminLogin']) && $jieqi_online_info['jieqiAdminLogin'] == 1) {
        $_SESSION['jieqiAdminLogin'] = 1;
    }
    $jieqi_user_info['jieqiUserId'] = $_SESSION['jieqiUserId'];
    $jieqi_user_info['jieqiUserUname'] = $_SESSION['jieqiUserUname'];
    $jieqi_user_info['jieqiUserName'] = $_SESSION['jieqiUserName'];
    $jieqi_user_info['jieqiUserGroup'] = $_SESSION['jieqiUserGroup'];
    $jieqi_user_info['jieqiUserGroupName'] = $jieqiGroups[$_SESSION['jieqiUserGroup']];
    $jieqi_user_info['jieqiUserVip'] = $_SESSION['jieqiUserVip'];
    $jieqi_user_info['jieqiUserHonorId'] = $_SESSION['jieqiUserHonorId'];
    $jieqi_user_info['jieqiUserHonor'] = $_SESSION['jieqiUserHonor'];
    if ($newmsgnum > 0) {
        $jieqi_user_info['jieqiNewMessage'] = $newmsgnum;
    }
    if ($usecookie) {
        $jieqi_user_info['jieqiUserPassword'] = $jieqiUsers->getVar('pass', 'n');
    }
    include_once JIEQI_ROOT_PATH . '/include/changecode.php';
    if (JIEQI_SYSTEM_CHARSET == 'gbk') {
        $jieqi_user_info['jieqiUserUname_un'] = jieqi_gb2unicode($_SESSION['jieqiUserUname']);
        $jieqi_user_info['jieqiUserName_un'] = jieqi_gb2unicode($_SESSION['jieqiUserName']);
        $jieqi_user_info['jieqiUserHonor_un'] = jieqi_gb2unicode($_SESSION['jieqiUserHonor']);
        $jieqi_user_info['jieqiUserGroupName_un'] = jieqi_gb2unicode($jieqiGroups[$_SESSION['jieqiUserGroup']]);
    } else {
        $jieqi_user_info['jieqiUserUname_un'] = jieqi_big52unicode($_SESSION['jieqiUserUname']);
        $jieqi_user_info['jieqiUserName_un'] = jieqi_big52unicode($_SESSION['jieqiUserName']);
        $jieqi_user_info['jieqiUserHonor_un'] = jieqi_big52unicode($_SESSION['jieqiUserHonor']);
        $jieqi_user_info['jieqiUserGroupName_un'] = jieqi_gb2unicode($jieqiGroups[$_SESSION['jieqiUserGroup']]);
    }
    $jieqi_user_info['jieqiUserLogin'] = JIEQI_NOW_TIME;
    if ($usecookie < 0) {
        $usecookie = 0;
    } elseif ($usecookie == 1) {
        $usecookie = 315360000;
    }
    if ($usecookie) {
        $cookietime = JIEQI_NOW_TIME + $usecookie;
    } else {
        $cookietime = 0;
    }
    @setcookie('jieqiUserInfo', jieqi_sarytostr($jieqi_user_info), $cookietime, '/', JIEQI_COOKIE_DOMAIN, 0);
    $jieqi_visit_info['jieqiUserLogin'] = $jieqi_user_info['jieqiUserLogin'];
    $jieqi_visit_info['jieqiUserId'] = $jieqi_user_info['jieqiUserId'];
    @setcookie('jieqiVisitInfo', jieqi_sarytostr($jieqi_visit_info), JIEQI_NOW_TIME + 99999999, '/', JIEQI_COOKIE_DOMAIN, 0);
    //更新在线用户
    include_once JIEQI_ROOT_PATH . '/lib/template/template.php';
    $jieqiTpl =& JieqiTpl::getInstance();
    $jieqiTpl->clear_cache(JIEQI_ROOT_PATH . '/templates/online.html');
    return 0;
}
コード例 #4
0
ファイル: footer.php プロジェクト: thu0ng91/jmc
if (empty($jieqiTset['jieqi_page_template'])) {
    $jieqiTpl->display(JIEQI_ROOT_PATH . '/themes/' . JIEQI_THEME_NAME . '/theme.html');
} else {
    if ($jieqiTset['jieqi_page_template'][0] != '/' && $jieqiTset['jieqi_page_template'][1] != ':') {
        $jieqiTpl->display(JIEQI_ROOT_PATH . '/' . $jieqiTset['jieqi_page_template']);
    } else {
        $jieqiTpl->display($jieqiTset['jieqi_page_template']);
    }
}
//处理推广
if (!empty($_GET['fromuid']) && defined('JIEQI_PROMOTION_VISIT') && (JIEQI_PROMOTION_VISIT > 0 || JIEQI_PROMOTION_REGISTER > 0)) {
    $_GET['fromuid'] = intval($_GET['fromuid']);
    jieqi_includedb();
    $query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
    if (JIEQI_PROMOTION_VISIT > 0) {
        $query->execute("REPLACE INTO " . jieqi_dbprefix('system_promotions') . " (ip, uid, username) VALUES ('" . jieqi_userip() . "', '" . $_GET['fromuid'] . "', '')");
    }
    if (JIEQI_PROMOTION_REGISTER > 0 && empty($_COOKIE['jieqiPromotion'])) {
        @setcookie('jieqiPromotion', $_GET['fromuid'], 0, '/', JIEQI_COOKIE_DOMAIN, 0);
    }
}
//推广积分
if (defined('JIEQI_PROMOTION_VISIT') && JIEQI_PROMOTION_VISIT > 0 && substr(date('is', JIEQI_NOW_TIME), -3) == '000') {
    jieqi_includedb();
    $query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
    $uidarray = array();
    $query->execute("SELECT * FROM " . jieqi_dbprefix('system_promotions'));
    while ($promotion = $query->getRow()) {
        if (is_numeric($promotion['uid'])) {
            $uidarray[] = intval($promotion['uid']);
        }
コード例 #5
0
ファイル: vnetoneconfirm.php プロジェクト: thu0ng91/jmc
 } else {
     //$money=round($money / 100);
     $orderid = $paylog->getVar('payid');
     //订单编号[商户网站]
     include_once JIEQI_ROOT_PATH . '/lib/template/template.php';
     $jieqiTpl =& JieqiTpl::getInstance();
     $jieqiTpl->assign('url_pay', $jieqiPayset[JIEQI_PAY_TYPE]['payurl']);
     $jieqiTpl->assign('spid', $jieqiPayset[JIEQI_PAY_TYPE]['payid']);
     $jieqiTpl->assign('spname', rawurlencode(JIEQI_SITE_NAME));
     $jieqiTpl->assign('spoid', $orderid);
     //订单号
     $spreq = 'http://' . JIEQI_LOCAL_HOST . jieqi_addurlvars(array(), false, false);
     $jieqiTpl->assign('spreq', $spreq);
     $jieqiTpl->assign('sprec', $jieqiPayset[JIEQI_PAY_TYPE]['payreturn']);
     $jieqiTpl->assign('userid', $_SESSION['jieqiUserId']);
     $jieqiTpl->assign('userip', jieqi_userip());
     $post_key = $orderid . $spreq . $jieqiPayset[JIEQI_PAY_TYPE]['payreturn'] . $jieqiPayset[JIEQI_PAY_TYPE]['payid'] . $jieqiPayset[JIEQI_PAY_TYPE]['paykey'] . $jieqiPayset[JIEQI_PAY_TYPE]['version'] . $money;
     //
     // '网站订单号码+ 请求地址+ 接收地址 + 5位spid+ 18位SP密码+支付的版本号+支付金额
     ////'LCase函数是将字符转换为小写; Ucase函数是将字符转换为大写
     //'全国声讯支付联盟全国声讯电话支付接口对MD5值只认大写字符串,所以小写的MD5值得转换为大写
     $md5password = strtoupper(md5($post_key));
     // '先MD5 32 然后转大写
     $jieqiTpl->assign('spmd5', $md5password);
     $jieqiTpl->assign('spcustom', rawurlencode(JIEQI_EGOLD_NAME));
     $jieqiTpl->assign('spversion', $jieqiPayset[JIEQI_PAY_TYPE]['version']);
     $jieqiTpl->assign('money', $money);
     $jieqiTpl->assign('urlcode', JIEQI_SYSTEM_CHARSET);
     $jieqiTpl->setCaching(0);
     $jieqiTpl->display($jieqiModules['pay']['path'] . '/templates/vnetone.html');
 }
コード例 #6
0
ファイル: main.php プロジェクト: thu0ng91/jmc
jieqi_checkpower($jieqiPower['system']['adminpanel'], $jieqiUsersStatus, $jieqiUsersGroup, false, true);
//包含页头页尾
include_once JIEQI_ROOT_PATH . '/admin/header.php';
$siteurl = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$siteurl = dirname(dirname($siteurl));
$siteip = @gethostbyname($_SERVER['SERVER_NAME']);
$jieqi_license_domain = '';
$matchs = array();
if (floatval(JIEQI_VERSION) >= 1.6) {
    $jieqi_license_ary = jieqi_funtoarray('base64_decode', explode('@', JIEQI_LICENSE_KEY));
} else {
    $jieqi_license_ary = explode('@', base64_decode(JIEQI_LICENSE_KEY));
}
if (!empty($jieqi_license_ary[1]) && preg_match('/^(http:\\/\\/|https:\\/\\/)?[^\\/\\?]*(' . $jieqi_license_ary[1] . ')/i', JIEQI_LOCAL_HOST, $matchs)) {
    $jieqi_license_domain = $jieqi_license_ary[1];
}
$jieqiTpl->assign('jieqi_customerurl', 'http://www.jieqi.com/modules/customer/siteback.php?sitename=' . urlencode(JIEQI_SITE_NAME) . '&siteurl=' . urlencode($siteurl) . '&jieqiversion=' . urlencode(JIEQI_VERSION) . '&versiontype=' . urlencode(JIEQI_VERSION_TYPE) . '&licensedomain=' . urlencode($jieqi_license_domain) . '&siteip=' . $siteip . '&userip=' . urlencode(jieqi_userip()) . '&jieqicharset=' . urlencode(JIEQI_CHAR_SET) . '&phpversion=' . urlencode(PHP_VERSION) . '&system=' . urlencode(PHP_OS) . '&freespace=' . intval(@disk_free_space($_SERVER['DOCUMENT_ROOT']) / 1048576) . '&zendoptimizer=' . urlencode(jieqi_zendoptimizerver()));
$jieqiTpl->display(JIEQI_ROOT_PATH . '/templates/admin/default.html');
function jieqi_zendoptimizerver()
{
    ob_start();
    phpinfo();
    $phpinfo = ob_get_contents();
    ob_end_clean();
    preg_match('/Zend(\\s|&nbsp;)Optimizer(\\s|&nbsp;)v([\\.\\d]*),/is', $phpinfo, $matches);
    if (!empty($matches[3])) {
        return $matches[3];
    } else {
        return '';
    }
}
コード例 #7
0
ファイル: userlocal.php プロジェクト: thu0ng91/jmc
/**
 * 本地用户注册,预处理
 * 
 * @param      array       $params 参数数组
 * 必须参数: $params['username'] - 用户名,$params['password'] - 密码,$params['email'] - 邮箱
 * @access     public
 * @return     int    
 */
function jieqi_uregister_lprepare(&$params)
{
    global $jieqiConfigs;
    global $jieqiLang;
    global $query;
    global $users_handler;
    //载入参数设置
    if (!isset($jieqiConfigs['system'])) {
        jieqi_getconfigs('system', 'configs');
    }
    //载入语言包
    if (!isset($jieqiLang['system'])) {
        jieqi_loadlang('users', 'system');
    }
    //初始化查询类
    if (!is_a($query, 'JieqiQueryHandler')) {
        jieqi_includedb();
        $query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
    }
    //获得注册人ip
    if (empty($params['uip']) || !is_numeric(str_replace('.', '', $params['uip']))) {
        $params['uip'] = jieqi_userip();
    }
    //同一个IP重复注册时间限制
    $jieqiConfigs['system']['regtimelimit'] = intval($jieqiConfigs['system']['regtimelimit']);
    if ($jieqiConfigs['system']['regtimelimit'] > 0) {
        $sql = "SELECT * FROM " . jieqi_dbprefix('system_registerip') . " WHERE ip='" . jieqi_dbslashes($params['uip']) . "' AND regtime>" . (JIEQI_NOW_TIME - $jieqiConfigs['system']['regtimelimit'] * 3600) . " LIMIT 0,1";
        $res = $query->execute($sql);
        if ($query->getRow()) {
            $params['error'] = sprintf($jieqiLang['system']['user_register_timelimit'], $jieqiConfigs['system']['regtimelimit']);
            if ($params['return']) {
                return false;
            } else {
                jieqi_printfail($params['error']);
            }
        }
    }
    //变量检查
    $params['username'] = trim($params['username']);
    //用户名转换成小写
    $fromstr = $params['username'];
    $strlen = strlen($fromstr);
    $tmpstr = '';
    for ($i = 0; $i < $strlen; $i++) {
        if (ord($fromstr[$i]) > 0x80) {
            $tmpstr .= $fromstr[$i] . $fromstr[$i + 1];
            $i++;
        } else {
            $tmpstr .= strtolower($fromstr[$i]);
        }
    }
    $params['username'] = $tmpstr;
    $params['email'] = trim($params['email']);
    $params['password'] = trim($params['password']);
    $params['repassword'] = trim($params['repassword']);
    if (empty($params['checkcode'])) {
        $params['checkcode'] = '';
    } else {
        $params['checkcode'] = trim($params['checkcode']);
    }
    $params['error'] = '';
    if (!is_a($users_handler, 'JieqiUsersHandler')) {
        include_once JIEQI_ROOT_PATH . '/class/users.php';
        $users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler');
    }
    //检查用户名格式
    if (strlen($params['username']) == 0) {
        $params['error'] .= $jieqiLang['system']['need_username'] . '<br />';
    } elseif (preg_match('/^\\s*$|^c:\\con\\con$|[@%,;:\\.\\|\\*\\"\'\\\\\\/\\s\\t\\<\\>\\&]| /is', $params['username'])) {
        $params['error'] .= $jieqiLang['system']['error_user_format'] . '<br />';
    } elseif ($jieqiConfigs['system']['usernamelimit'] == 1 && !preg_match('/^[A-Za-z0-9]+$/', $params['username'])) {
        $params['error'] .= $jieqiLang['system']['username_need_engnum'] . '<br />';
    }
    //检查昵称
    if (isset($params['nickname'])) {
        if (strlen($params['nickname']) == 0) {
            $params['error'] .= $jieqiLang['system']['need_nickname'] . '<br />';
        } elseif (preg_match('/^\\s*$|^c:\\con\\con$|[@%,;:\\.\\|\\*\\"\'\\\\\\/\\s\\t\\<\\>\\&]| /is', $params['nickname'])) {
            $params['error'] .= $jieqiLang['system']['error_nick_format'] . '<br />';
        }
    } else {
        $params['nickname'] = $params['username'];
    }
    //检查Email格式
    if (strlen($params['email']) == 0) {
        $params['error'] .= $jieqiLang['system']['need_email'] . '<br />';
    } elseif (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+([\\.][a-z0-9-]+)+\$/i", $params['email'])) {
        $params['error'] .= $jieqiLang['system']['error_email_format'] . '<br />';
    }
    //检查密码
    if (strlen($params['password']) == 0 || strlen($params['repassword']) == 0) {
        $params['error'] .= $jieqiLang['system']['need_pass_repass'] . '<br />';
    } elseif ($params['password'] != $params['repassword']) {
        $params['error'] .= $jieqiLang['system']['password_not_equal'] . '<br />';
    }
    //检查用户名是否已注册
    if ($users_handler->getByname($params['username'], 3) != false) {
        $params['error'] .= $jieqiLang['system']['user_has_registered'] . '<br />';
    }
    //检查昵称是否已注册
    if ($params['nickname'] != $params['username'] && $users_handler->getByname($params['nickname'], 3) != false) {
        $params['error'] .= $jieqiLang['system']['nick_has_used'] . '<br />';
    }
    //检查Email是否已注册
    if ($users_handler->getCount(new Criteria('email', $params['email'], '=')) > 0) {
        $params['error'] .= $jieqiLang['system']['email_has_registered'] . '<br />';
    }
    //检查验证码
    if (!empty($jieqiConfigs['system']['checkcodelogin']) && $params['checkcode'] != $_SESSION['jieqiCheckCode']) {
        $params['error'] .= $jieqiLang['system']['error_checkcode'] . '<br />';
    }
    //记录注册信息
    if (!empty($params['error'])) {
        if ($params['return']) {
            return false;
        } else {
            jieqi_printfail($params['error']);
        }
    } else {
        return true;
    }
}