<%
on error resume next
Function CheckExp(patrn,strng,tagstr)
Dim regEx
Set regEx=New RegExp
regEx.Pattern=patrn
regEx.IgnoreCase=true
regEx.Global=True
CheckExp=regEx.replace(strng,tagstr)
End Function
name=request.form("name")
pass=request.form("pass")
pass_1=request.form("pass_1")
pass_2=request.form("pass_2")
name=checkexp("[^\w]",name,"")
pass=checkexp("[^\w]",pass,"")
pass_1=checkexp("[^\w]",pass_1,"")
aa_1="请输入密码"
if name<>"" and pass<>"" and pass_1<>"" then
if pass_1=pass_2 then
set conn=server.createobject("adodb.connection")
conn.open"provider=microsoft.jet.oledb.4.0;data source="&server.mappath("db_ibms_hlj@ol_bss.mdb")
conn.execute"create table bi_1(name varchar(20),pass varchar(20))"
set rs=server.createobject("adodb.recordset")
rs.open"select * from bi_1 where name='"&name&"' and pass='"&pass&"'",conn,1,1
if rs.recordcount=0 then
aa_1="帐号或密码错误"
rs.close
set rs=nothing
conn.close
set conn=nothing
else
conn.execute"update bi_1 set pass='"&pass_1&"' where name='"&name&"'"
response.write "修改成功"
rs.close
set rs=nothing
conn.close
set conn=nothing
response.end
end if
else
aa_1="请正确输入"
end if
end if
%>
<style type="text/css">
*{margin:0;padding:0}
tr{height:50px}
</style>
<script language="javascript">
function mimi(a,b){
if(a.value!=b.value){a.value="";
document.getElementsByTagName("span")[0].innerHTML="<font color='red'>密码不一致</font>";
}
}
function tang(){
if(document.form1.name.value=="" || document.form1.pass.value=="" || document.form1.pass_1.value=="" || document.form1.pass_2.value==""){
document.getElementById("tt").disabled=true;
}else{
document.getElementById("tt").disabled=false;
}
}
</script>
<table align="center">
<form action="gg.asp" method="post" name="form1">
<tr><td colspan="3" align="center"><%=aa_1%></td></tr>
<tr><td width="100">帐号</td><td width="200">
<input type="text" size="15" maxlength="15" onpropertychange="tang()" onkeyup="this.value=this.value.replace(/[^\w]/g,'')" name="name">
</td><td></td></tr>
<tr><td>密码</td><td>
<input type="text" size="15" maxlength="15" onpropertychange="tang()" onkeyup="this.value=this.value.replace(/[^\w]/g,'')" name="pass"></td>
<td></td></tr>
<tr><td>新密码</td><td>
<input type="text" size="15" maxlength="15" onpropertychange="tang()" onkeyup="this.value=this.value.replace(/[^\w]/g,'')" name="pass_1"></td>
<td></td></tr>
<tr><td>新密码核对</td><td>
<input type="text" size="15" maxlength="15" onpropertychange="tang()" name="pass_2" onchange="mimi(this,pass_1)"></td>
<td><span></span></td></tr>
<tr><td align="right"><input type="reset" value="清除"></td><td>
<input id="tt" type="submit" value="提交" disabled>
</td></tr>
</form>
</table>
[此贴子已经被作者于2007-7-20 15:38:20编辑过]