说明:此插件由aligo大人制作,耗时3天在大脑中构思,程序20分钟完成,后又经历2天时间调试浏览器平台兼容性,现在请向aligo大人的辛苦付出致敬!
安装必读:再安装此插件之前高呼99遍“aligo大人万岁!aligo大人是我们的神!”,并且充分阅读安装步骤,了解自己是否能够正确安装。
演示地址:http://msgene.cn/bbs/
安装后如出现一切问题,请找插件区版主进行技术支持,aligo大人事务繁忙,概不负责!
1、打开register.htm,找到
下面插入
- <STYLE type=text/css>
- .pwd-strength {
- padding: 2px;
- padding-left: 5px;
- padding-right: 5px;
- width: 150px;
- border: solid 1px #CCCCCC;
- }
- .pwd-strength-box,
- .pwd-strength-box-low,
- .pwd-strength-box-med,
- .pwd-strength-box-hi
- {
- color: #464646;
- text-align: center;
- width: 33%;
- }
- .pwd-strength-box-low
- {
- color: #990000;
- background-color: #FFECEC;
- }
- .pwd-strength-box-med
- {
- color: #000066;
- background-color: #D2E9FF;
- }
- .pwd-strength-box-hi
- {
- color: #003300;
- background-color: #DDFFDD;
- }
- </STYLE>
复制代码
找到- <form method="post" name="register" action="register.php?regsubmit=yes" $enctype onSubmit="this.regsubmit.disabled=true;">
复制代码
下面加入
- <SCRIPT language=javascript>
- function checkPassword(pwd){
- var objLow=document.getElementById("pwdLow");
- var objMed=document.getElementById("pwdMed");
- var objHi=document.getElementById("pwdHi");
- objLow.className="pwd-strength-box";
- objMed.className="pwd-strength-box";
- objHi.className="pwd-strength-box";
- if(pwd.length<6){
- objLow.className="pwd-strength-box-low";
- }else{
- var p1= (pwd.search(/[a-zA-Z]/)!=-1) ? 1 : 0;
- var p2= (pwd.search(/[0-9]/)!=-1) ? 1 : 0;
- var p3= (pwd.search(/[^A-Za-z0-9_]/)!=-1) ? 1 : 0;
- var pa=p1+p2+p3;
- if(pa==1){
- objLow.className="pwd-strength-box-low";
- }else if(pa==2){
- objMed.className="pwd-strength-box-med";
- }else if(pa==3){
- objHi.className="pwd-strength-box-hi";
- }
- }
- }
- function checkPassword2() {
- var objpwd2Ok=document.getElementById("pwdOk");
- var objpwd2Err=document.getElementById("pwdErr");
- if(document.register.password.value==document.register.password2.value){
- objpwd2Ok.className="pwd-strength-box-hi";
- objpwd2Err.className="pwd-strength-box";
- }else{
- objpwd2Ok.className="pwd-strength-box";
- objpwd2Err.className="pwd-strength-box-low";
- }
- }
- function checkMail(Txt) {
- var objmailOk=document.getElementById("mailOk");
- var objmailErr=document.getElementById("mailErr");
- var filter=/^[a-zA-Z][a-zA-Z0-9._-]*@([a-zA-Z0-9-_]+\.)+(com|gov|net|com\.cn|edu\.cn)$/;
- if(filter.test(Txt)){
- objmailOk.className="pwd-strength-box-hi";
- objmailErr.className="pwd-strength-box";
- }else{
- objmailOk.className="pwd-strength-box";
- objmailErr.className="pwd-strength-box-low";
- }
- }
- function getXMLHttpRequest() {
- var xmlhttp;
- try {
- xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {
- xmlhttp = false;
- }
- }
- if (!xmlhttp) {
- xmlhttp = new XMLHttpRequest();
- }
- return xmlhttp;
- }
- function checkUsername(name) {
- var objnameOk=document.getElementById("nameOk");
- var objnameErr=document.getElementById("nameErr");
- var xmlHttp=getXMLHttpRequest();
- xmlHttp.abort()
- xmlHttp.open("GET","register.php?user=" + name,"true");
- xmlHttp.onreadystatechange=function() {
- if (xmlHttp.readyState==4) {
- if(xmlHttp.responseText=="1") {
- objnameOk.className="pwd-strength-box-hi";
- objnameErr.className="pwd-strength-box";
- }else{
- objnameOk.className="pwd-strength-box";
- objnameErr.className="pwd-strength-box-low";
- }
- }
- }
- xmlHttp.send(null);
- }
- </SCRIPT>
复制代码
找到- <input type="text" name="username" size="25" maxlength="25">
- <input type="button" value="{lang register_check_username}" onclick="window.open('member.php?action=check&username='+this.form.username.value);">
复制代码
替换成
- <input onkeyup="checkUsername(this.value);"type="text" name="username" size="25" maxlength="25">
- <TABLE class="pwd-strength" cellSpacing=0 cellPadding=0 width="100%" height="20">
- <TBODY>
- <TR>
- <TD class=pwd-strength-box id=nameOk>正确</TD>
- <TD class=pwd-strength-box id=nameErr>错误</TD></TR></TBODY></TABLE>
复制代码
找到- <input type="password" name="password" size="25">
复制代码
替换成
- <input onkeyup="checkPassword(this.value);" type="password" name="password" size="25"><TABLE class="pwd-strength" cellSpacing=0 cellPadding=0 width="100%">
- <TBODY>
- <TR>
- <TD class=pwd-strength-box id=pwdLow>低</TD>
- <TD class=pwd-strength-box id=pwdMed>中</TD>
- <TD class=pwd-strength-box id=pwdHi>高</TD></TR></TBODY></TABLE>
复制代码
找到- <input type="password" name="password2" size="25">
复制代码
替换成
- <input onkeyup="checkPassword2();" type="password" name="password2" size="25">
- <TABLE class="pwd-strength" cellSpacing=0 cellPadding=0 width="100%" height="20">
- <TBODY>
- <TR>
- <TD class=pwd-strength-box id=pwdOk>正确</TD>
- <TD class=pwd-strength-box id=pwdErr>错误</TD></TR></TBODY></TABLE>
复制代码
找到- <input type="text" name="email" size="25">
- <!--{if $regverify == 1}--> <span class="smalltxt">{lang register_email_comment}</span><!--{/if}-->
- <!--{if $censoremail}--> <span class="smalltxt">{lang register_email_censor}</span><!--{/if}-->
复制代码
替换成
- <input onkeyup="checkMail(this.value);" type="text" name="email" size="25">
- <TABLE class="pwd-strength" cellSpacing=0 cellPadding=0 width="100%" height="20">
- <TBODY>
- <TR>
- <TD class=pwd-strength-box id=mailOk>正确</TD>
- <TD class=pwd-strength-box id=mailErr>错误</TD></TR></TBODY></TABLE>
- <!--{if $regverify == 1}--> <span class="smalltxt">{lang register_email_comment}</span><!--{/if}-->
- <!--{if $censoremail}--> <span class="smalltxt">{lang register_email_censor}</span><!--{/if}-->
复制代码
2、打开register.php
找到- include template('register');
复制代码
替换成
- if (isset($_GET["user"])) {
- $username = trim($_GET["user"]);
- $query = $db->query("SELECT * FROM {$tablepre}members WHERE username='$username'");
- if($db->fetch_array($query)) {
- echo "0";
- }
- elseif(strlen($username) > 15) {
- echo "0";
- } elseif(preg_match("/^\s*$|^c:\\con\\con$| |[%,\*"\s\t\<\>\&] |^游客|^Guest/is", $username) || @preg_match('/^'.str_replace(array('\\*', ',', ' '), array('.*', '|', ''), preg_quote($censoruser, '/')).'$/i', $username)) {
- echo "0";
- } else {
- echo "1";
- }
- }else{
- include template('register');
- }
复制代码 |