/**
  * 校验用户名
  * @param $username 用户名
  * @return int
  */
 function checkUsername($username)
 {
     global $rg_config;
     L::loadClass('register', 'user', false);
     if (!PW_Register::checkNameLen(strlen($username))) {
         return 1;
     }
     $S_key = array("\\", '&', ' ', "'", '"', '/', '*', ',', '<', '>', "\r", "\t", "\n", '#', '%', '?', ' ', '..');
     foreach ($S_key as $value) {
         if (strpos($username, $value) !== false) {
             return 2;
         }
     }
     if (!$rg_config['rg_rglower'] && !PW_Register::checkRglower($username)) {
         return 3;
     }
     $banname = explode(',', $rg_config['rg_banname']);
     foreach ($banname as $value) {
         if ($value !== '' && strpos($username, $value) !== false) {
             return 2;
         }
     }
     require_once R_P . 'uc_client/uc_client.php';
     if (uc_user_get($username)) {
         return 4;
     } else {
         return 0;
     }
 }
Example #2
0
 /**
  * @static
  */
 function checkName($regname)
 {
     if (!PW_Register::checkNameLen(strlen($regname))) {
         Showmsg('reg_username_limit');
     }
     if (str_replace($this->illegalChar, '', $regname) != $regname) {
         Showmsg('illegal_username');
     }
     if (!L::reg('rg_rglower') && !PW_Register::checkRglower($regname)) {
         Showmsg('username_limit');
     }
     if (S::inArray(strtolower($regname), array('guest', 'system'))) {
         Showmsg('illegal_username');
     }
     $banname = explode(',', L::reg('rg_banname'));
     foreach ($banname as $key => $value) {
         if ($value !== '' && strpos($regname, $value) !== false) {
             Showmsg('illegal_username');
         }
     }
     require_once R_P . 'require/functions.php';
     if ($regname !== Sql_cv($regname)) {
         Showmsg('illegal_username');
     }
 }
Example #3
0
 InitGP(array('type'), 'P');
 if ($type == 'regname') {
     require_once R_P . 'lib/register.class.php';
     InitGP('username', 'P');
     if (!PW_Register::checkNameLen(strlen($username))) {
         echo 1;
         ajax_footer();
     }
     $S_key = array("\\", '&', ' ', "'", '"', '/', '*', ',', '<', '>', "\r", "\t", "\n", '#', '%', '?', ' ');
     foreach ($S_key as $value) {
         if (strpos($username, $value) !== false) {
             echo 2;
             ajax_footer();
         }
     }
     if (!$rg_config['rg_rglower'] && !PW_Register::checkRglower($username)) {
         echo 3;
         ajax_footer();
     }
     $banname = explode(',', $rg_config['rg_banname']);
     foreach ($banname as $value) {
         if ($value && strpos($username, $value) !== false) {
             echo 2;
             ajax_footer();
         }
     }
     require_once R_P . 'uc_client/uc_client.php';
     if (uc_user_get($username)) {
         echo 4;
     } else {
         echo 0;