<!--#include file="Inc/Conn.asp"-->
<!--#include file="Head.asp"-->
<!--#include file="Admin/MD5.asp"-->
<!--#include file="Inc/Code.asp"-->
<!--#include file="Inc/eshopcode.asp"-->
<%
If Session("MyUserName")="" or Session("MyPassWord")="" Then
Response.Redirect "Server.asp" 
End if
Set rs=Server.CreateObject("Adodb.Recordset")
Sql="Select * From [User] Where [UserName]='"&Session("MyUserName")&"' and [PassWord]='"&Session("MyPassWord")&"' "
rs.Open Sql,Conn,1,1
If rs.Eof or rs.Bof Then
Response.Redirect "Server.asp" 
End if

If Request.QueryString("action")="update" Then
Call UpdaNews
        Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('资料更新成功!请返回...');" & Chr(13)
		Response.write "window.document.location.href='UpUser.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
        Response.End
End if
Dim Sexa
Dim Dfc
Dim a
Dim b
If rs("Sex")=1 Then Sexa = "CHECKED"
If rs("Sex")=0 Then Dfc =  "CHECKED"
If rs("Compname")<>"" Then
a = rs("Compname")
End If
If rs("Fox")<>"" Then
b = rs("Fox")
End if
Dim Uphtml
UpHtml = application("JaUpUser")
UpHtml = Replace(UpHtml,"{用户登陆}",UserLogin())
UpHtml = Replace(UpHtml,"{用户搜索}",FindProd())
UpHtml = Replace(UpHtml,"{用户投票}",ShowVote())
UpHtml = Replace(UpHtml,"{数字}",rs("ID"))
UpHtml = Replace(UpHtml,"{用户名称}",rs("UserName"))
UpHtml = Replace(UpHtml,"{用户问题}",rs("Question"))
UpHtml = Replace(UpHtml,"{用户答案}",rs("Answer"))
UpHtml = Replace(UpHtml,"{性别1}",Sexa)
UpHtml = Replace(UpHtml,"{性别2}",Dfc)
UpHtml = Replace(UpHtml,"{电邮}",rs("Email"))
UpHtml = Replace(UpHtml,"{主页}",rs("Home"))
UpHtml = Replace(UpHtml,"{名称}",a)  
UpHtml = Replace(UpHtml,"{编号}",rs("Zip"))
UpHtml = Replace(UpHtml,"{电话}",rs("Phone"))
UpHtml = Replace(UpHtml,"{传真}",b)  
Response.Write UpHtml
rs.Close
Set rs=Nothing
%>
<!--#Include File="bottom.Asp"-->
<%
Sub UpdaNews
userid=Clng(Request("userid"))
Question=checkstr(Trim(Request.Form("Question")))
Answer=checkstr(Trim(Request.Form("Answer")))
sex=Request("sex")
email=checkstr(Trim(Request.Form("email")))
home=checkstr(Trim(Request.Form("home")))
Comane=checkstr(Trim(Request.Form("Comane")))
Zip=checkstr(Trim(Request.Form("Zip")))
Phone=checkstr(Trim(Request.Form("Phone")))
Fox=checkstr(Trim(Request.Form("Fox")))
pass=md5(Trim(Request.Form("pass"))) 
Sql1 = "Update [User] Set [Question]='"&Question&"',[Answer]='"&Answer&"',[Sex]='"&sex&"',[Email]='"&email&"'"
If Trim(Request.Form("pass"))<>"" Then
Session("MyPassWord") = Pass
Sql1 = Sql1 & ",[PassWord]='"&Pass&"'"
End if
Sql1 = Sql1 & ",[Zip]='"&Zip&"',[Phone]='"&Phone&"' Where ID="&userid
Conn.Execute (Sql1)

Sql2 = "Update [User] Set [Compname]="
If Comane="" Then
Sql2 = Sql2 & " Null Where ID="&userid
Else
Sql2 = Sql2 & " '"&Comane&"' Where ID="&userid
End if
Conn.Execute (Sql2)

Sql3 = "Update [User] Set [Home]="
If home="" Then
Sql3 = Sql3 & " Null Where ID="&userid
Else
Sql3 = Sql3 & " '"&home&"' Where ID="&userid
End if
Conn.Execute (Sql3)

Sql4 = "Update [User] Set [Fox]="
If Fox="" Then
Sql4 = Sql4 & " Null Where ID="&userid
Else
Sql4 = Sql4 & " '"&Fox&"' Where ID="&userid
End if
Conn.Execute (Sql4)
End Sub
%>