以下代碼中的數(shù)值3改成自己想要的最小長度如1,15改成自己想要的最大長度如40
1、uc_client\model\user.php
if($$$$len > 15 || $$$$len < 3 || preg_match("/\s+|^c:\\con\\con|[%,\*\"\s\<\>\&]|$$$$guestexp/is", $$$$username))
2、template\default\member\register.htm
<input type="text" id="{$$$$this->setting['reginput']['username']}" name="" class="px" tabindex="1" autocomplete="off" size="25" maxlength="15" required />
3、source\language\member\lang_template.php
'register_username_tips' => '用戶名由 3 到 15 個(gè)字符組成',
4、static\js\register.js
if(unlen < 3 || unlen > 15) {
errormessage(id, unlen < 3 ? '用戶名不得小于 3 個(gè)字符' : '用戶名不得超過 15 個(gè)字符');
5、source\class\class_member.php
-
if($$usernamelen < 3) {
-
showmessage('profile_username_tooshort');
-
} elseif($$usernamelen > 15) {
復(fù)制代碼
6、source/module/forum/forum_ajax.php
-
if($$usernamelen < 3) {
-
showmessage('profile_username_tooshort', '', array(), array('handle' => false));
-
} elseif($$usernamelen > 15) {
復(fù)制代碼
7、升級數(shù)據(jù)庫(只對關(guān)鍵字段進(jìn)行升級,基本滿足正常使用了),本例中最大長度修改為40
-
ALTER TABLE `pre_common_member` CHANGE `username` `username` CHAR( 40 ) ;
-
ALTER TABLE `pre_home_blog` CHANGE `username` `username` CHAR( 40 ) ;
-
ALTER TABLE `pre_ucenter_members` CHANGE `username` `username` CHAR( 40 ) ;
-
ALTER TABLE `pre_ucenter_mergemembers` CHANGE `username` `username` CHAR( 40 ) ;
-
ALTER TABLE `pre_ucenter_feeds` CHANGE `username` `username` CHAR( 40 ) ;
-
ALTER TABLE `pre_forum_post` CHANGE `author` `author` CHAR( 40 ) ;
-
ALTER TABLE `pre_forum_thread` CHANGE `author` `author` CHAR( 40 ) ;
-
ALTER TABLE `pre_home_album` CHANGE `username` `username` CHAR( 40 ) ;
-
ALTER TABLE `pre_forum_announcement` CHANGE `author` `author` CHAR( 40 ) ;
-
ALTER TABLE `pre_forum_groupuser` CHANGE `username` `username` CHAR( 40 ) ;
復(fù)制代碼