<!--#include file="conn.asp"-->
<!--#include file="func.asp"-->
<%dim action,username
action=FormatSQL(SafeRequest("action",0))
username=strUserName
select case action
'//收货人信息
case "receiveaddr"
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from [user] where username='"&username&"' ",conn,1,3
rs("receipt")=trim(request.form("receipt"))
rs("city")=trim(request.form("city"))
rs("address")=trim(request.form("address"))
rs("postcode")=cstr(request.form("postcode"))
rs("usertel")=trim(request.form("usertel"))
rs("UserMobile")=cstr(request.form("UserMobile"))
rs("UserQQ")=trim(request.form("UserQQ"))
rs("MSN")=trim(request.form("MSN"))
rs("deliverymethord")=int(request.form("deliverymethord"))
rs("paymethord")=int(request.form("paymethord"))
rs("UserSex")=int(request.form("UserSex"))
rs.Update
rs.Close
set rs=nothing
conn.close
set conn=nothing
response.Write "<script language=javascript>alert('您的收货信息保存成功！');history.go(-1);</script>"
response.End
'//用户资料
case "customerinfo"
set rs=server.CreateObject("adodb.recordset")
rs.open "select useremail,realname,UserQuestion,UserAnswer from [user] where username='"&username&"'",conn,1,3
if request.form("useremail")="" then
response.Write "<script language=javascript>alert('请填写电子邮件！');history.go(-1);</script>"
conn.close
set conn = nothing
response.End
end if
rs("useremail")=trim(request.form("useremail"))
rs("realname")=trim(request.form("realname"))
if request.form("UserQuestion")="" then
response.Write "<script language=javascript>alert('请填密码问题！');history.go(-1);</script>"
conn.close
set conn = nothing
response.End
end if
rs("UserQuestion")=trim(request.form("UserQuestion"))
if trim(request.form("UserAnswer"))<>""then
rs("UserAnswer")=md5(trim(request.form("UserAnswer")))
end if
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.Write "<script language=javascript>alert('您的个人资料修改成功！');history.go(-1);</script>"

case "changepass"
set rs=server.CreateObject("adodb.recordset")
rs.open "select UserPassword from [user] where username='"&username&"'",conn,1,3
if md5(trim(request.form("UserPassword")))<>trim(rs("UserPassword")) then
rs.close
set rs=nothing
conn.close
set conn=nothing
response.Write "<script language=javascript>alert('对不起，您输入的原密码错误！');history.go(-1);</script>"
response.End
else
rs("UserPassword")=md5(trim(request.form("UserPassword1")))
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.Write "<script language=javascript>alert('密码更改成功！');history.go(-1);</script>"
response.End
end if

case "repass"
set rs=server.CreateObject("adodb.recordset")
rs.open "select UserPassword from [user] where username='"&trim(request.form("username2"))&"'",conn,1,3
rs("UserPassword")=md5(trim(request.form("UserPassword1")))
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.Write "<script language=javascript>alert('您的密码取回成功，请登录！');history.go(-1);</script>"
end select
%>