<!--#include file="conn.asp" -->
<%
'检查来源,拒绝非法入侵者
Call checkPrePage()

if request.QueryString("action")="save" then
	'-----------------------------------------修改会员资料-----------------------------------------
	'检查用户合法性
	if Trim(Session("m_UserID"))="" then
		ShowMsg "<strong><font color=red>您还没登录，或离开时间超过20分钟!</font></strong><br><br>您可以选择下面操作：<br>[<a href=.>登录网站</a>][<a href=.>返回首页</a>]"
	end if
	
	strSQL="Update web_member Set "
	strSQL=strSQL & "m_name='" & Replace(request.Form("txtName"),"'","''") & "',"
	strSQL=strSQL & "m_password='" & Replace(request.Form("txtPassWord1"),"'","''") & "',"
	strSQL=strSQL & "m_realname='" & Replace(request.Form("txtRealName"),"'","''") & "',"
	strSQL=strSQL & "m_number='" & Replace(request.Form("txtNumber"),"'","''") & "',"
	strSQL=strSQL & "m_email='" & Replace(request.Form("txtEmail"),"'","''") & "',"
	strSQL=strSQL & "m_sex='" & Replace(request.Form("rdoSex"),"'","''") & "',"
	strSQL=strSQL & "m_address='" & Replace(request.Form("txtAddress"),"'","''") & "',"
	strSQL=strSQL & "m_tel='" & Replace(request.Form("txtTel"),"'","''") & "',"
	strSQL=strSQL & "m_province='" & Replace(request.Form("selProvince"),"'","''") & "',"
	strSQL=strSQL & "m_like='" & Replace(request.Form("chkLike"),"'","''") & "',"
	strSQL=strSQL & "m_depict='" & Replace(request.Form("txtDepict"),"'","''") & "' Where id=" & Trim(Session("m_UserID"))
	'response.Write(strSQL)

	conn.execute strSQL,0,1
	response.Redirect("error.asp?msg=" & Server.URLEncode("<strong><font color=red>修改成功!</font></strong><br>您的资料已经修改成功！<br>您可以选择下面操作：<br>[<a href=.>返回首页</a>]") & "&err=0")
else
	'-----------------------------------------注册新会员-------------------------------------------
	'检查是否已存在本用户
	strSQL="Select id From web_member Where m_name='" & request.Form("txtName") & "' And m_id=" & WebUserID

	rs.open strSQL,conn,1,1
	if rs.recordcount>0 then
		ShowMsg "<strong><font color=red>注册失败!</font></strong><br>此用户名已经被注册，请改用其它用户名！"
	end if
	
	strSQL="Insert Into web_member(m_id,m_name,m_password,m_realname,m_email,m_sex,m_address,m_tel,m_province,m_like,m_depict) Values("
	strSQL=strSQL & "" & WebUserID & ","
	strSQL=strSQL & "'" & Replace(request.Form("txtName"),"'","''") & "',"
	strSQL=strSQL & "'" & Replace(request.Form("txtPassWord1"),"'","''") & "',"
	strSQL=strSQL & "'" & Replace(request.Form("txtRealName"),"'","''") & "',"
	strSQL=strSQL & "'" & Replace(request.Form("txtEmail"),"'","''") & "',"
	strSQL=strSQL & "'" & Replace(request.Form("rdoSex"),"'","''") & "',"
	strSQL=strSQL & "'" & Replace(request.Form("txtAddress"),"'","''") & "',"
	strSQL=strSQL & "'" & Replace(request.Form("txtTel"),"'","''") & "',"
	strSQL=strSQL & "'" & Replace(request.Form("selProvince"),"'","''") & "',"
	strSQL=strSQL & "'" & Replace(request.Form("chkLike"),"'","''") & "',"
	strSQL=strSQL & "'" & Replace(request.Form("txtDepict"),"'","''") & "')"
	
	conn.execute strSQL,0,1
	response.Redirect("error.asp?msg=" & Server.URLEncode("<strong><font color=red>注册成功!</font></strong><br>恭喜，" & request.Form("txtName") & " 注册成功，请牢记您的密码！<br>下面您可以选择：<br>[<a href=.>登录网站</a>] [<a href=.>返回首页</a>]") & "&err=0")
end if
%>

