为了更好地打击BBS流氓程序, 本论坛将禁止注册中文用户名
为了有效防止一些BBS机器人恶意注册和灌水,本论坛修改了用户注册程序,将禁止使用中文用户名注册。
具体修改了DZ 6.0论坛程序的 register.php 和 ajax.php 两个文件,DZ 7.0可以参考此办法。
1. 修改ajax.php文件:
查找: $ucresult = uc_user_checkname($username);
改为:
if(!preg_match("/^[a-zA-Z0-9_\-\.]+$/i", $username))
{
$ucresult = -2;
}else{
$ucresult = uc_user_checkname($username);
}
2. 修改register.php文件:
查找:$username = addslashes(trim(stripslashes($username)));
改为(添加几行代码):
$username = addslashes(trim(stripslashes($username)));
if(!preg_match("/^[a-zA-Z0-9_\-\.]+$/i", $username))
{
showmessage('profile_username_protect');
}