<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>  
<%Response.CodePage=65001%>  
<%Response.Charset="utf-8"%>
<!--#include file="../inc/conn.asp" -->
<!--#include file="../inc/Function.asp" -->
<!--#include file="../inc/inc.Asp" -->
<!--#include file="../inc/MD5.asp" -->
<!--#include file="userSystem.asp" -->
<%
	'版权：世纪伟成(http://yidacms.com)
	'本信息不会影响您网站的正常访问，无论免费用户或是收费用户请保留这里的信息.
	'如果您删除了这里的版权信息,将追究法律责任.

			if request("yidacms")="reg" Then
	dim rs,sql
	set rs=server.createobject("adodb.recordset")
	sql="select * from shuaiweb_user where shuaiweb_useremail='"&request.Form("shuaiweb_useremail")&"'"  
	rs.open sql,dbok,1,1
		if Request.Form("shuaiweb_useremail")="" then 
			response.write "<script language=javascript> alert('账户E-mail不能为空！');history.go(-1);</script>"
			response.end
		end if
		if Request.Form("shuaiweb_userpass")="" then 
			response.write "<script language=javascript> alert('密码不能为空！');history.go(-1);</script>"
			response.end
		end if
		if Request.Form("shuaiweb_username")="" then 
			response.write "<script language=javascript> alert('姓名不能为空！');history.go(-1);</script>"
			response.end
		end if
		if not rs.bof and not rs.eof then
			Response.Write("<script language=""JavaScript"">alert(""错误：你注册的E-mail账户已经存在！"");history.go(-1);</script>")
			response.end
		end if
		if Request.Form("shuaiweb_userpass")<>Request.Form("shuaiweb_userpass2") then 
			response.write "<script language=javascript> alert('两次输入的密码不一样！');history.go(-1);</script>"
			response.end
		end if
		If Trim(Request.Form("validatecode"))=Empty Or Trim(Session("cnbruce.com_ValidateCode"))<>Trim(Request.Form("validatecode")) Then
			response.write("<script language=javascript> alert('验证码错误，请从新输入！');history.go(-1);</script>")
			response.end
		end if
	set rs=server.createobject("adodb.recordset")
	sql="select * from shuaiweb_user"  
	rs.open sql,dbok,3,2
	rs.addnew 
		rs("shuaiweb_useremail")=trim(request.form("shuaiweb_useremail"))
		rs("shuaiweb_userpass")=left(MD5(trim(request.form("shuaiweb_userpass"))),10)
		rs("shuaiweb_username")=trim(request.form("shuaiweb_username"))
		rs("shuaiweb_usertel")=filter_Str(trim(request.form("shuaiweb_usertel")))
		rs("shuaiweb_userqq")=filter_Str(trim(request.form("shuaiweb_userqq")))
		rs("shuaiweb_usermsn")=filter_Str(trim(request.form("shuaiweb_usermsn")))
		rs("shuaiweb_useraddress")=filter_Str(trim(request.form("shuaiweb_useraddress")))
		rs("shuaiweb_userportrait")=""&sw_dizhi&"template/user/images/u11.gif"
		rs("shuaiweb_usernote")=filter_Str(trim(request.form("shuaiweb_usernote")))
		rs("shuaiweb_usernumber")=filter_Str(trim(request.form("shuaiweb_usernumber")))
		rs("shuaiweb_qqapi")=filter_Str(trim(request.form("shuaiweb_qqapi")))
		rs("shuaiweb_weiboapi")=filter_Str(trim(request.form("shuaiweb_weiboapi")))
	rs.update
			session("shuaiweb_useremail")=request.Form("shuaiweb_useremail")
			if yidacms_jmailuserreg = 1 then
			yidacms_jmail(1)
			if err.number<>0 then
				mailtz = "没有邮件发送!"
					else
				mailtz =  "并给您发送了邮件通知，请注意查收!"
			end if
			response.write "<script language=javascript> alert('注册成功！\n\n"&mailtz&"');location.replace('index.asp');</script>"
			elseif yidacms_jmailuserreg = 2 then
			response.write "<script language=javascript> alert('注册成功！');location.replace('index.asp');</script>"
			end if
			rs.Close
			set rs=nothing
			End If

	if request("yidacms")="login" Then
	shuaiweb_useremail = filter_Str(request.Form("shuaiweb_useremail"))
	shuaiweb_userpass = filter_Str(left(MD5(request.Form("shuaiweb_userpass")),10))
	set rs=server.createobject("adodb.recordset")
	sql="select * from shuaiweb_user where shuaiweb_useremail='"&shuaiweb_useremail&"' and shuaiweb_userpass='"&shuaiweb_userpass&"'" 
	rs.open sql,dbok,1,1
	If Trim(Request.Form("validatecode"))=Empty Or Trim(Session("cnbruce.com_ValidateCode"))<>Trim(Request.Form("validatecode")) Then
		response.write("<script language=javascript> alert('验证码错误，请从新输入！');history.go(-1);</script>")
		response.end
	End If
	if not rs.bof and not rs.eof then
	session("shuaiweb_useremail")=request.Form("shuaiweb_useremail")
	if rs("shuaiweb_usercontrol") = 1 then 
		response.write "<script language=javascript> alert('您的账户被锁定,请联系网站管理员!');history.go(-1);</script>"
		response.end
	end if
			response.Redirect "index.asp" 
				else
			response.write "<script language=javascript> alert('E-mail账户或密码不正确，请从新登录！');history.go(-1);</script>" 
			response.end
	end if
	end if

	if request("yidacms")="system" Then
	set rs=server.createobject("adodb.recordset")
	user_id = cint(request("id"))
	sql="select * from shuaiweb_user WHERE id= "&user_id&""  
	rs.open sql,dbok,1,1
			if session("shuaiweb_useremail")="" then
				response.write "请从新登录！"
				response.end
			end if
	if Request.Form("shuaiweb_username")="" then 
		response.write "<script language=javascript> alert('姓名不能为空！');history.go(-1);</script>"
		response.end
	end if
	set rs=server.createobject("adodb.recordset")
	sql="select * from shuaiweb_user WHERE id= "&user_id&""
	rs.open sql,dbok,1,3
		rs("shuaiweb_useremail")=trim(request.form("shuaiweb_useremail"))
		rs("shuaiweb_userpass")=trim(request.form("shuaiweb_userpass"))
		rs("shuaiweb_username")=trim(request.form("shuaiweb_username"))
		rs("shuaiweb_usertel")=filter_Str(trim(request.form("shuaiweb_usertel")))
		rs("shuaiweb_userqq")=filter_Str(trim(request.form("shuaiweb_userqq")))
		rs("shuaiweb_usermsn")=filter_Str(trim(request.form("shuaiweb_usermsn")))
		rs("shuaiweb_useraddress")=filter_Str(trim(request.form("shuaiweb_useraddress")))
		rs("shuaiweb_userportrait")=filter_Str(trim(request.form("shuaiweb_userportrait")))
		rs("shuaiweb_usernote")=filter_Str(trim(request.form("shuaiweb_usernote")))
		rs("shuaiweb_usernumber")=filter_Str(trim(request.form("shuaiweb_usernumber")))
	rs.update
	rs.close
	set rs=nothing
	response.write "<script language=javascript> alert('修改成功！');location.replace('user_system.asp');parent.location.reload();</script>"
	End If

	if request("yidacms")="password" Then
	set rs=server.createobject("adodb.recordset")
	user_id1 = request("id")
	sql="select * from shuaiweb_user WHERE id= "&user_id1&""
	rs.open sql,dbok,1,1
	if Request.Form("shuaiweb_userpass")="" then 
		response.write "<script language=javascript> alert('密码不能为空！');history.go(-1);</script>"
		response.end
	end if
	if Request.Form("shuaiweb_userpass")<>Request.Form("shuaiweb_userpass2") then 
		response.write "<script language=javascript> alert('两次输入的密码不一样！');history.go(-1);</script>"
		response.end
	end if
	set rs=server.createobject("adodb.recordset")
	user_id2 = request("id")
	sql="select * from shuaiweb_user WHERE id= "&user_id2&""
	rs.open sql,dbok,1,3
		rs("shuaiweb_useremail")=trim(request.form("shuaiweb_useremail"))
		rs("shuaiweb_userpass")=left(MD5(trim(request.form("shuaiweb_userpass"))),10)
		rs("shuaiweb_username")=trim(request.form("shuaiweb_username"))
		rs("shuaiweb_usertel")=filter_Str(trim(request.form("shuaiweb_usertel")))
		rs("shuaiweb_userqq")=filter_Str(trim(request.form("shuaiweb_userqq")))
		rs("shuaiweb_usermsn")=filter_Str(trim(request.form("shuaiweb_usermsn")))
		rs("shuaiweb_useraddress")=filter_Str(trim(request.form("shuaiweb_useraddress")))
		rs("shuaiweb_userportrait")=filter_Str(trim(request.form("shuaiweb_userportrait")))
		rs("shuaiweb_usernote")=filter_Str(trim(request.form("shuaiweb_usernote")))
		rs("shuaiweb_usernumber")=filter_Str(trim(request.form("shuaiweb_usernumber")))
	rs.update
	rs.close
	set rs=nothing
	session("shuaiweb_useremail")=request.Form("shuaiweb_useremail")
	response.write "<script language=javascript> alert('修改成功！');location.replace('user_pass.asp');</script>"
	End If

	if request("yidacms")="buydel" Then
	set rs=server.createobject("adodb.recordset")
	user_id3 = request("id")
	sql="select * from shuaiweb_buy WHERE id= "&user_id3&""
	rs.open sql,dbok,1,1
	if rs("shuaiweb_reading") = 1 then
			response.write "<script language=javascript> alert('已发货的订单不可以删除!');history.go(-1);</script>"
			response.end
			   else
	if(request("id") <> "") then id = request("id")
	set rs = server.createobject("adodb.recordset")
	user_id4 = request("id")
	sql="DELETE * FROM shuaiweb_buy WHERE id= "&user_id4&""
	rs.open sql,dbok,1,1
	rs.update
	rs.close
	set rs=nothing
	response.write "<script language=javascript> alert('成功删除！');location.replace('user_buy.asp');</script>"
	End If
	end if
%>