<html>
<!--包含用户登陆校验文件-->
<!--包含连接数据库文件-->
<!--#include file="dbconn.asp"-->
<!--#include file="Glfunction.asp"-->
<%
dim Action,UserName,FoundErr,ErrMsg
dim rsUser,sqlUser
Action=trim(request("Action"))
UserID=trim(request("UserID"))
if Action="" and session("UserID")="" then
response.redirect "index.asp"
end if
if Action="Modify" and UserID<>"" then
Set rsUser=Server.CreateObject("Adodb.RecordSet")
sqlUser="select * from [T_B_WebUser] where UserID='" & UserID & "'"
rsUser.Open sqlUser,conn,1,3
if rsUser.bof and rsUser.eof then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>找不到指定的用户!</li>"
else
dim OldPassword,Password,PwdConfirm
OldPassword=trim(request("OldPassword"))
Password=trim(request("Password"))
PwdConfirm=trim(request("PwdConfirm"))
if OldPassword="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请输入旧密码!</li>"
else
if Instr(OldPassword,"=")>0 or Instr(OldPassword,"%")>0 or Instr(OldPassword,chr(32))>0 or Instr(OldPassword,"?")>0 or Instr(OldPassword,"&")>0 or Instr(OldPassword,";")>0 or Instr(OldPassword,",")>0 or Instr(OldPassword,"'")>0 or Instr(OldPassword,",")>0 or Instr(OldPassword,chr(34))>0 or Instr(OldPassword,chr(9))>0 or Instr(OldPassword,"")>0 or Instr(OldPassword,"$")>0 then
errmsg=errmsg+"<br><li>旧密码中含有非法字符</li>"
founderr=true
else
if OldPassword<>rsUser("PWD") then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>你输入的旧密码不正确,没有权限修改!</li>"
end if
end if
end if
if strLength(Password)>12 or strLength(Password)<6 then
founderr=true
errmsg=errmsg & "<br><li>请输入新密码(不能大于12小于6)。</li>"
else
if Instr(Password,"=")>0 or Instr(Password,"%")>0 or Instr(Password,chr(32))>0 or Instr(Password,"?")>0 or Instr(Password,"&")>0 or Instr(Password,";")>0 or Instr(Password,",")>0 or Instr(Password,"'")>0 or Instr(Password,",")>0 or Instr(Password,chr(34))>0 or Instr(Password,chr(9))>0 or Instr(Password,"")>0 or Instr(Password,"$")>0 then
errmsg=errmsg+"<br><li>新密码中含有非法字符</li>"
founderr=true
end if
end if
if PwdConfirm="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请输入确认密码!</li>"
else
if PwdConfirm<>Password then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>确认密码与新密码不一致!</li>"
end if
end if
if FoundErr<>true then
rsUser("PWD")=Password
rsUser.update
end if
end if
rsUser.close
set rsUser=nothing
if FoundErr=True then
call WriteErrMsg()
else
response.write"<SCRIPT language=JavaScript>alert('成功修改密码!');"
response.write"javascript:history.go(-1)</SCRIPT>"
end if
else
%>
===================
此处是表格
===================
</body>
</html>
<%
END IF
rsUser.CloseConn()
%>
參考答案:出什么错了? 代码不够具体...没法判断嘛...
不过有个地方很怪异...可能是个人习惯问题...
sqlUser="select * from [T_B_WebUser] where UserID='" & UserID & "'"
你的USERID不是整型的吗?