 <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!--#include file="Ex_Cls/Ex_SkinCls.asp"-->
<!--#include file="Ex_Cls/Ex_SplitPageCls.asp"-->
<%
Dim ExComm
Set ExComm=new Ex_CommonCls
ExComm.GetConfigCache("runmode,ShowName,CmtPageSize,IsCheckCode,cmtmsgcheckre,iscmtmsgcheck,LogNum,blogname,BlogDescription,BlogKeyWord,IndexAddWord,blogurl,logourl,DefaultSkin")
ExComm.CheckInstall
ExComm.IsIpAllow
Dim Title,Show_logids,show_blogKeyword
Dim show_user,action
action=request("action")
Select Case action
	Case "modify"
	modify
	Case "protocol"
	show_user=ShowProtocol
	Case "loginout"
	loginout
	Case "FIndPwd"
	show_user=ShowFindPwd
	Case Else
	show_user=show_modifyinfo
End Select 
'***********************************************
'输出注册信息修改表单
'***********************************************
function show_modifyinfo()
dim userrs,modifuinfoSql,username

if ExComm.IsLogin("user")=False  then
	ExComm.ShowMsg "你还没有登陆",""
end if
modifuinfoSql="select * from Ex_user where username='"&ExComm.F(session("user"))&"'"
set userrs=server.CreateObject("adodb.recordset")
userrs.open modifuinfoSql,Conn,1,1
dim str 
str=""
str=str& "<table width=""98%"" border=""0"">"
str=str& "<form id=""form1"" name=""form1"" method=""post"" action=""?action=modify"">"
str=str& "  <tr>"
str=str& "    <td colspan=""2""><div align=""center""><strong>用户注册信息修改</strong></div></td>"
str=str& "    </tr>"
str=str& "  <tr>"
str=str& "    <td width=""40%""><div align=""right"">用户名：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><label>"
str=str& "      <input name=""username"" type=""text"" id=""username"" value="""&Trim(userRs("username"))&""" readonly/>"
str=str& "      <font color=red>*</font></label></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td><div align=""right"">密&nbsp;&nbsp;码：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><label>"
str=str& "      <input name=""userpwd"" type=""password"" id=""userpwd"" value=""""/>"
str=str& "      <font color=red>*不修改密码请留空</font></label></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td><div align=""right"">密码确认：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><label>"
str=str& "      <input name=""userpwd1"" type=""password"" id=""userpwd1"" value=""""/>"
str=str& "      <font color=red>*</font></label></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td><div align=""right"">电子信箱：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><label>"
str=str& "      <input name=""email"" type=""text"" id=""email"" value="""&userRs("email")&"""/>"
str=str& "      <font color=red>*</font> <font color=red>忘记密码时，用于取回密码"
str=str& "</span></label></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td><div align=""right"">个人主页：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><input name=""homepage"" type=""text"" id=""homepage"" value="""&userRs("homepage")&"""/></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td><div align=""right"">QQ：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><input name=""QQ"" type=""text"" id=""QQ"" value="""&userRs("QQ")&"""/></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td><div align=""right"">性别：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><label>"
str=str& "      <input type=""radio"" name=""sex"" value=""男"" checked/>"
str=str& "      男&nbsp;"
str=str& "      <input type=""radio"" name=""sex"" value=""女"" />"
str=str& "    女&nbsp;&nbsp;"
str=str& "    <input type=""radio"" name=""sex"" value=""保密"" />"
str=str& "    保密</label></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td><div align=""right"">密码提示问题：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><input name=""question"" type=""text"" id=""question"" value="""&userRs("question")&"""/></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td><div align=""right"">密码提示答案：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><input name=""answer"" type=""text"" id=""answer"" value="""&userRs("answer")&"""/></td>"
str=str& "  </tr>"
str=str& "  <tr style=""display:none;"">"
str=str& "    <td><div align=""right"">注册条款：</div></td>"
str=str& "    <td><label>"
str=str& "      <input type=""radio"" name=""protocol"" value=""yes"" checked/>"
str=str& "      同意&nbsp;&nbsp;"
str=str& "      <input type=""radio"" name=""protocol"" value=""no"" />"
str=str& "      不同意&nbsp;&nbsp;<a href=""?action=protocol"">查看注册条款</a> </label></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td><div align=""right"">验证码：</div></td>"
str=str& "    <td style=""text-align:left;padding-left:20px;""><input name=""checkcode"" type=""text"" id=""checkcode"" size=""15"" /><img src=""inc/checkcode.asp"" style=""cursor:hand"" onclick=""this.src='inc/checkcode.asp';"" alt=""看不清?点一下"" /></td>"
str=str& "  </tr>"
str=str& "  <tr>"
str=str& "    <td colspan=""2""><label>"
str=str& "      <div align=""center"">"
str=str& "        <input type=""submit"" name=""Submit"" value=""修改"" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
str=str& "        <input type=""reset"" name=""Submit2"" value=""重置"" />"
str=str& "        </div>"
str=str& "    </label></td>"
str=str& "    </form>"
str=str& "  </tr>"
str=str& "</table>"
show_modifyinfo=str
end function
'*************************************************
'修改注册用户信息
'*************************************************
sub Modify()
	dim username,userpwd,userpwd1,sex,protocol,homepage,email,QQ,question,answer,checkcode,usersql
	protocol=ExComm.G(request.Form("protocol"))
	if protocol="yes" then
		checkcode=request.Form("checkcode")
		if session("excheckcode")<>checkcode then
			ExComm.ShowMsg "验证码不正确",""
		end if
		username=ExComm.F(trim(request.Form("username")))
		if trim(username)="" then
			ExComm.ShowMsg "用户名不能为空",""
		end If
		If InStr(Trim(username),"'") Then 
			ExComm.ShwoMsg "用户名中不能有单引号",""
		End If 
		userpwd=trim(request.Form("userpwd"))
		userpwd1=Trim(request.Form("userpwd1"))
		if trim(userpwd)<>trim(userpwd1) then
			ExComm.ShowMsg "两次输入的密码不一致",""
		end If
		If InStr(UserPwd,"'")<>0 Then 
			ExComm.ShowMsg "密码中不能有单引号",""
		End If 
		email=ExComm.F(request.Form("email"))
		if trim(email)="" then
			ExComm.ShowMsg "电子邮箱不能为空",""
		end if
		sex=ExComm.F(request.Form("sex"))
		homepage=ExComm.F(request.Form("homepage"))
		QQ=ExComm.F(request.Form("QQ"))
		question=ExComm.F(request.Form("question"))
		answer=ExComm.F(request.Form("answer"))
		If UserPwd<>"" Then 
			UserSql="update Ex_User set userpwd='"&userpwd&"',sex='"&sex&"',homepage='"&homepage&"',email='"&email&"',qq='"&qq&"',question='"&question&"',answer='"&answer&"' where username='"&username&"'"
		Else 
			UserSql="update Ex_User set sex='"&sex&"',homepage='"&homepage&"',email='"&email&"',qq='"&qq&"',question='"&question&"',answer='"&answer&"' where username='"&username&"'"
		End If 
		Conn.Execute UserSql
		ExComm.ShowMsg "修改成功","UserEditINFO.asp"
	else
		ExComm.ShowMsg "您只有同意注册条款才能提交修改信息",""
	end If
end Sub
'输出注册条款
Function ShowProtocol
	ShowProtocol=ShowProtocol&"您在注册前必须仔细阅读并同意以下条款才能继续注册：<br> "
	ShowProtocol=ShowProtocol&"遵守中华人民共和国的各项有关法律法规;<br> "
	ShowProtocol=ShowProtocol&"不得发布任何色情非法,以及危害国家安全的言论;<br> "
    ShowProtocol=ShowProtocol&"严禁链接有关政治敏感,色情,宗教敏感,迷信,恐怖主义等一切违法信息;<br> "
	ShowProtocol=ShowProtocol&"您将承担一切因您的行为而直接或间接导致的民事或刑事法律责任; <br>"
	ShowProtocol=ShowProtocol&"互相尊重,遵守互联网络道德,对自己的言论和行为负责,严禁互相恶意攻击,漫骂; <br>"
    ShowProtocol=ShowProtocol&"本站管理员拥有所有管理权限。<br>"
	ShowProtocol=ShowProtocol&"<a href=""UserReg.asp"">开始注册</a><br>"
End Function
'输出注册条款
Function ShowFindPwd
	ShowFindPwd=ShowFindPwd&"请留言，并注明你注册时邮箱等相关信息。密码会发到你的信箱的。<br> "
End Function 
'注销登陆
Sub LoginOut
	Response.Cookies(Md5(SN))("uname")=""
	Response.Cookies(Md5(SN))("upwd")=""
	Response.Cookies(Md5(SN))("homepage")=""
	session.Abandon()
	response.Redirect Application(sn&"blogurl")
	response.end
End Sub 

'主模板标记替换开始
Dim ExSkin,Head,Body,Bottom,Skin1
Set ExSkin=new Ex_SkinCls
Skin1=ExSkin.GetTxtSkin("default.html")
Body=Replace(Skin1,"$show_log$",show_user)
Body=Replace(Body,"$show_info$",ExSkin.Info)
Body=Replace(Body,"$show_login$",ExSkin.Login)
Body=Replace(Body,"$show_calendar$",ExSkin.calendar("","",""))
Set ExSkin=Nothing    
Bottom=ExComm.BottomInfo
Title="用户资料修改"
'输出内容
Head=Head&"<html xmlns=""http://www.w3.org/1999/xhtml"">"&vbcrlf
Head=Head&"<head>"&vbcrlf
Head=Head&"<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"">"&vbcrlf
Head=Head&"<meta name=""generator"" content=""易心博客"">"&vbcrlf
Head=Head&"<meta name=""Description"" content="""&Application(sn&"BlogDscription")&""">"&vbcrlf
Head=Head&"<meta name=""Keywords"" content="""&Application(sn&"BlogKeyWord")&""">"&vbcrlf
Head=Head&"<title>"&Title&Application(sn&"IndexAddWord")&"</title>"&vbcrlf
Head=Head&"<script src=""inc/Main.js""></script>"
Head=Head&"<script src=""inc/UserInfo.js""></script>"
Head=Head&"<script src=""inc/jquery.js""></script>"
Head=Head&"<link href=""inc/OblogSkin.Css"" rel=""stylesheet"" type=""text/css"" />"&vbcrlf
Head=Head&"</head>"&vbcrlf
Head=Head&"<body>"&vbcrlf
If ExComm.IsOblogSkin Then 
	Response.Write Head
	Response.Write Body
	Response.Write "</body></html>"
Else
	Body=Replace(Body,"$show_blogtitle$",Title&Application(sn&"IndexAddWord"))
	Body=Replace(Body,"$show_blogkeyword$",Application(sn&"blogkeyword"))
	Body=Replace(Body,"$show_blogdescription$",Application(sn&"blogdescription"))
	Response.Write Body
End If 
If request.querystring("action")="add" Then
Call add()
End if
If Application(Sn&"Runmode")<>"静态" Then 
	ExComm.visitorCount
End If
Set ExComm=Nothing 
%>