<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<!--#include file="chkadmin.asp"-->
<!--#include file="inc/char.asp"-->
<%dim usr,pwd,pwd2,email,qq,icq,msn,homepage
usr=Trim(Request.Form("usr"))
pwd=Trim(Request.Form("pwd"))
pwd2=Trim(Request.Form("pwd2"))
email=Trim(Request.Form("email"))
qq=Trim(Request.Form("qq"))
icq=Trim(Request.Form("icq"))
msn=Trim(Request.Form("msn"))
homepage=Trim(Request.Form("homepage"))

dim sql,errmsg,founderr
founderr=false

if chkadmin=false then
	founderr=true
	errmsg=errmsg+"<li>请不要非法修改他人的资料</li>"
end if

if pwd="" or pwd2="" then
	founderr=true
	errmsg=errmsg+"<li>密码不能为空</li>"
elseif strlen(pwd)<4 or strlen(pwd)>20 then
	founderr=true
	errmsg=errmsg+"<li>密码长度应为4～20个字符</li>"
elseif pwd<>pwd2 then
	founderr=true
	errmsg=errmsg+"<li>两次输入的密码不一致</li>"
end if

if Email="" then
	founderr=true
	errmsg=errmsg+"<li>E-mail不能为空</li>"
elseif IsValidEmail(Email)=false then
	founderr=true
	errmsg=errmsg+"<li>E-mail地址格式不正确</li>"
end if

if qq<>"" and isInteger(qq)=false then
	founderr=true
	errmsg=errmsg+"<li>QQ号码必须是数字</li>"
end if

if icq<>"" and isInteger(icq)=false then
	founderr=true
	errmsg=errmsg+"<li>ICQ号码必须是数字</li>"
end if

if msn<>"" and IsValidEmail(msn)=false then
	founderr=true
	errmsg=errmsg+"<li>MSN格式不正确</li>"
end if

if founderr=false then
	conn.execute("update UserInfo set PWD='"&pwd&"',Email='"&email&"',QQ='"&qq&"',ICQ='"&icq&"',MSN='"&msn&"',Homepage='"&homepage&"' where USR='"&usr&"'")
	dim gourl,msg
	gourl="user_info.asp"
	msg="资料修改成功！"
	call ok()
else
	call error()
end if

conn.close
set conn=nothing
%>