<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/chkinput.asp"-->
<!--#include file="inc/md5.asp"-->
<%
Dim DownloadClass_Ads
Dim Rs
Dim SQL
Dim ErrMsg
Dim Sucmsg
Dim Founderr
Dim NowStats
Dim HtmlTitle
Dim Style_CSS
Dim HtmlTempStr
Dim TempTopStr
Dim TempFootStr
Dim username,userid
UpdateInfo
If IsObject(DownloadClass_Ads) Then
	Set DownloadClass_Ads = Nothing
End If
CloseConn
Public Sub UpdateInfo()
	Response.Expires = 0
	Response.ExpiresAbsolute = Now() - 1
	Response.cachecontrol = "no-cache"
	Founderr = False
	DownsysClass.LoadTemplates ("")
	Set DownloadClass_Ads = New Adcolumn_Cls
	Set Rs = CreateObject("adodb.recordset")
	If DownsysClass.memberName = Empty Then
		Response.Write "<script>alert('" & DownsysClass.mainset(39) & "');location.replace('login.asp')</script>"
		Response.End
	End If
	If CInt(DownsysClass.Setting(42)) = 0 Then
		Response.Write "<script>alert('" & DownsysClass.mainset(38) & "');javascript:history.back(1)</script>"
		Response.End
	End If
	NowStats = "修改用户资料"
	HtmlTitle = "修改用户资料"
	TempTopStr = DownsysClass.mainhtml(0) & DownsysClass.mainhtml(1) & DownsysClass.mainhtml(2) & DownsysClass.mainhtml(3)
	TempFootStr = DownsysClass.mainhtml(4)
	Style_CSS = Replace(Replace(DownsysClass.Style_CSS, "{$SetupDir}", DownsysClass.SetupDir), "{$PicUrl}", DownsysClass.TempDir)
	HtmlTempStr = TempTopStr
	HtmlTempStr = Replace(HtmlTempStr, "{$NavMenu}", DownsysClass.SortingMenu)
	HtmlTempStr = Replace(HtmlTempStr, "{$Width}", DownsysClass.mainset(0))
	HtmlTempStr = Replace(HtmlTempStr, "{$Style_CSS}", Style_CSS)
	If CInt(DownsysClass.Setting(5)) = 0 Then
		HtmlTempStr = Replace(HtmlTempStr, "{$TopMeun}", DownsysClass.mainset(9))
	Else
		HtmlTempStr = Replace(HtmlTempStr, "{$TopMeun}", DownsysClass.mainset(10))
	End If
	HtmlTempStr = Replace(HtmlTempStr, "{$NowStats}", NowStats)
	HtmlTempStr = Replace(HtmlTempStr, "{$Title}", HtmlTitle)
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(0)}", DownloadClass_Ads.RunScriptAds(7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(1)}", DownloadClass_Ads.BannerAds(7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(2)}", DownloadClass_Ads.AdsColumn(7, 2))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(3)}", DownloadClass_Ads.AdsColumn(7, 3))
	Response.Write HtmlTempStr
	
	If CInt(DownsysClass.Setting(5)) = 1 Then
		TempFootStr = Replace(TempFootStr, "{$FootMeun}", DownsysClass.mainset(11))
	Else 
		TempFootStr = Replace(TempFootStr, "{$FootMeun}", DownsysClass.mainset(44))
	End If
	
	TempFootStr = Replace(TempFootStr, "{$Width}", DownsysClass.mainset(0))
	TempFootStr = Replace(TempFootStr, "{$Adcolumn(4)}", DownloadClass_Ads.ScriptFloatAds(7))
	TempFootStr = Replace(TempFootStr, "{$Adcolumn(5)}", DownloadClass_Ads.ScriptFixedAds(7))
	Response.Write "<script language=""JavaScript"">" & vbCrLf
	Response.Write "<!--" & vbCrLf
	Response.Write "function CheckForm()" & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.username.value.length == 0)" & vbCrLf
	Response.Write " {" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入用户名."");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.username.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.truename.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的真实姓名！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.truename.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.usertel.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的联系电话！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.usertel.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.address.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的联系地址！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.address.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.question.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的密码提示问题！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.question.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return true;" & vbCrLf
	Response.Write "}" & vbCrLf
	Response.Write "//-->"
	Response.Write "</script>" & vbCrLf
	Response.Write "<TABLE width="""
	Response.Write DownsysClass.mainset(0)
	Response.Write """ class=TableBorder cellSpacing=0 cellPadding=0 align=center border=0>" & vbCrLf
	Response.Write " <TR vAlign=top>" & vbCrLf
	Response.Write " <TD class=Border2> <BR style=""OVERFLOW: hidden; LINE-HEIGHT: 5px"">" & vbCrLf
	Select Case Request("action")
		Case "save"
			Call modify
		Case Else
			Call main
	End Select
	If Founderr = True Then
		Response.Write "<script>alert('" & ErrMsg & "');javascript:history.back(1)</script>"
	End If
	Response.Write " </TD></TR></TABLE>" & vbCrLf
	Response.Write TempFootStr
End Sub


Private Sub main()
	Rs.Open "Select * from [NC_User] where username='" & DownsysClass.memberName & "' and userid=" & DownsysClass.memberid & "", conn, 1, 1
	If Rs.bof And Rs.EOF Then
		Response.Write "Sorry！没有找到此用户信息信息。"
	Else
		Response.Write " <TABLE align=center cellSpacing=0 cellPadding=5 width=""90%"" border=0>" & vbCrLf
		Response.Write " <TR bgColor=#F6F6F6>" & vbCrLf
		Response.Write " <TD height=24><IMG border=0 src=""images/sword_org.gif"" align=absMiddle> 修改用户资料　<a href=updatepass.asp>修改用户密码</a>　<a href=logout.asp>退 出</a></TD></TR>" & vbCrLf
		Response.Write " <TR>" & vbCrLf
		Response.Write " <TD height=1 bgColor=#E6E6E6></TD>" & vbCrLf
		Response.Write " </TR></TABLE>" & vbCrLf
		Response.Write " <BR style=""OVERFLOW: hidden; LINE-HEIGHT: 5px"">" & vbCrLf
		Response.Write "<table width=""90%"" border=""0"" cellspacing=""1"" align=center bgColor=#e6e6e6 cellpadding=""5"">" & vbCrLf
		Response.Write "<form method=""post"" name=myform action=""updateinfo.asp?action=save"" onSubmit=""return CheckForm();"">" & vbCrLf
		Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
		Response.Write " <td width=""30%""><div align=""right"">用户名：</div></td>" & vbCrLf
		Response.Write " <td width=""70%"">&nbsp; <STRONG> <FONT color=#cc0000>"
		Response.Write DownsysClass.memberName
		Response.Write "</FONT> </STRONG>" & vbCrLf
		Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您的点数:<STRONG><FONT color=#cc0000>"
		Response.Write Rs("money")
		Response.Write "</FONT></STRONG>" & vbCrLf
		Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您今日下载了 <STRONG><FONT color=#cc0000>"
		Response.Write Rs("DayDownNum")
		Response.Write "</FONT></STRONG> 个软件" & vbCrLf
		Response.Write " <INPUT type=hidden name=username value="""
		Response.Write DownsysClass.memberName
		Response.Write """><INPUT type=hidden name=userid value="""
		Response.Write DownsysClass.memberid
		Response.Write """></td>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write " <tr bgColor=#fefdf5>" & vbCrLf
		Response.Write " <td><div align=""right"">真实姓名：</div></td>" & vbCrLf
		Response.Write " <td><input name=""truename"" type=""text"" id=""truename"" size=""20"" value="""
		Response.Write Rs("truename")
		Response.Write """>" & vbCrLf
		Response.Write " <font color=""#FF0000"">*</font></td>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
		Response.Write " <td><div align=""right"">电子邮箱：</div></td>" & vbCrLf
		Response.Write " <td><input name=""usermail"" type=""text"" id=""usermail"" value="""
		Response.Write Rs("usermail")
		Response.Write """>" & vbCrLf
		Response.Write " <font color=""#FF0000"">注意</font>：请填写你常用的邮箱</td>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write " <tr bgColor=#fefdf5> " & vbCrLf
		Response.Write " <td><div align=""right"">密码提示问题：</div></td>" & vbCrLf
		Response.Write " <td><input name=""question"" type=""text"" id=""question"" size=""30"" value="""
		Response.Write Rs("question")
		Response.Write """ maxlength=""30"">" & vbCrLf
		Response.Write " 如：<font color=""#FF0000"">你最喜欢的宠物</font></td>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
		Response.Write " <td><div align=""right"">密码提示答案：</div></td>" & vbCrLf
		Response.Write " <td><input name=""answer"" type=""text"" id=""answer"" size=""30"" maxlength=""30"">" & vbCrLf
		Response.Write " 注意：<font color=""#FF0000"">不修改答案请留空!</font></td>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write " <tr bgColor=#fefdf5> " & vbCrLf
		Response.Write " <td><div align=""right"">联系电话：</div></td>" & vbCrLf
		Response.Write " <td><input name=""usertel"" type=""text"" id=""usertel"" value="""
		Response.Write Rs("usertel")
		Response.Write """>" & vbCrLf
		Response.Write " <font color=""#FF0000"">*</font> +86-27-85188888</td>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
		Response.Write " <td><div align=""right"">你的ＱＱ：</div></td>" & vbCrLf
		Response.Write " <td><input name=""oicq"" type=""text"" id=""oicq"" onkeyup=if(isNaN(this.value))this.value='' value="""
		Response.Write Rs("oicq")
		Response.Write """ maxlength=""20""></td>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write " <tr bgColor=#fefdf5> " & vbCrLf
		Response.Write " <td><div align=""right"">邮政编码：</div></td>" & vbCrLf
		Response.Write " <td><input name=""postcode"" type=""text"" id=""postcode"" maxlength=""20"" value="""
		Response.Write Rs("postcode")
		Response.Write """>" & vbCrLf
		Response.Write " <font color=""#FF0000"">*</font></td>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
		Response.Write " <td><div align=""right"">联系地址：</div></td>" & vbCrLf
		Response.Write " <td><input name=""address"" type=""text"" id=""address"" size=""45"" maxlength=""50"" value="""
		Response.Write Rs("address")
		Response.Write """>" & vbCrLf
		Response.Write " <font color=""#FF0000"">*</font></td>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write " <tr bgColor=#fefdf5> " & vbCrLf
		Response.Write " <td>&nbsp;</td>" & vbCrLf
		Response.Write " <td>&nbsp;&nbsp;" & vbCrLf
		Response.Write " <input name=""Submit"" type=""submit"" class=""button"" value=""立即修改"">" & vbCrLf
		Response.Write " <input name=""Submit2"" type=""reset"" class=""button"" value=""重　置"">" & vbCrLf
		Response.Write " </td>" & vbCrLf
		Response.Write " </tr></form>" & vbCrLf
		Response.Write "</table>" & vbCrLf
		Response.Write "<BR style=""OVERFLOW: hidden; LINE-HEIGHT: 5px"">" & vbCrLf
	End If
	Rs.Close
End Sub


Private Sub chkmodify()
	username = Replace(Request.Form("username"),"'","''")
	userid = CLng(Request.Form("userid"))
	If DownsysClass.checkpost = False Then
		ErrMsg = ErrMsg + "您提交的数据不合法，请不要从外部提交注册。\n"
		Founderr = True
	End If
	If DownsysClass.IsValidStr(Request.Form("username")) = False Then
		ErrMsg = ErrMsg + "用户中含有非法字符 \n"
		Founderr = True
		Exit Sub
	End If
	If Trim(Request.Form("usermail")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "您的Email不能为空。\n"
	End If
	If IsValidEmail(Trim(Request.Form("usermail"))) = False Then
		ErrMsg = ErrMsg + "您的Email有错误。\n"
		Founderr = True
	End If
	If Len(Request.Form("truename")) > 15 Then
		Founderr = True
		ErrMsg = ErrMsg + "真实姓名不能大于15个字符。\n"
	End If
	If Trim(Request.Form("truename")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "你没有输入真实姓名户名。\n"
	End If
	If Trim(Request.Form("question")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "请输入密码提示问题。\n"
	End If
	If Trim(Request.Form("usertel")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "请输入你的联系电话。\n"
	End If
	If Trim(Request.Form("postcode")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "请输入你的邮政编码。\n"
	End If
	If Trim(Request.Form("address")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "请输入你的联系地址。\n"
	End If
	If Not IsNumeric(Request.Form("oicq")) And Request.Form("oicq") <> "" Then
		Founderr = True
		ErrMsg = ErrMsg + "QQ号码请用数字填写。\n"
	End If
End Sub


Private Sub modify()
	Call chkmodify
	If Founderr = False Then
		SQL = "select * from [NC_user] where username='" & username & "' and userid=" & userid
		Rs.Open SQL, conn, 1, 3
		If Rs.bof And Rs.EOF Then
			Response.Write "Sorry！没有找到此用户信息信息。"
		Else
			Rs("usermail") = Request.Form("usermail")
			Rs("postcode") = Request.Form("postcode")
			Rs("question") = Request.Form("question")
			Rs("oicq") = Trim(Request.Form("oicq"))
			Rs("truename") = Request.Form("truename")
			Rs("usertel") = Request.Form("usertel")
			Rs("address") = Trim(Request.Form("address"))
			If Request.Form("answer") <> "" Then
				Rs("answer") = md5(Request.Form("answer"))
			End If
			Rs.Update
		End If
		Rs.Close
		Set Rs = Nothing
		Response.Write ("<script>alert('您的资料修改成功!\n\n请记住您的新用户资料');javascript:history.back(1)</script>")
		Response.End
	End If
End Sub
%>
