<!--#include file="inc/config_conn_root.asp"-->
<!--#include file="inc/functions_md5.asp"-->
<%        
function SQLCheck(str)

	dim c
	
	c=0
	SQLCheck=""
	
	if str="" then exit function
	
	c=c+Instr(str,"'")
	c=c+Instr(str,"=")
	c=c+Instr(str,"!")
	c=c+Instr(str,"%")
	c=c+Instr(str,"*")
	c=c+Instr(str,"&")
	c=c+Instr(str,">")
	c=c+Instr(str,"<")
	c=c+Instr(str,"\")
	c=c+Instr(str,"/")
	c=c+Instr(str,"+")
	c=c+Instr(str,"(")
	c=c+Instr(str,")")
	c=c+Instr(str,"^")
	c=c+Instr(str,"$")
	c=c+Instr(str,"#")
	c=c+Instr(str,"""")
	
	if c=0 then
	   SQLCheck=str
	else
	   SQLCheck=""
	end if

end function

Function GetError(info, location)

    session("FB_EM_1_SQL_info") = info
    session("FB_EM_1_SQL_location") = location&""" target=""_top"
    Response.Redirect "error.asp"
    Response.End

End Function
Function GetInfo(info, location)

    session("FB_EM_1_SQL_info") = info
    session("FB_EM_1_SQL_location") = location&""" target=""_top"
    Response.Redirect "suc.asp"
    Response.End

End Function
'/////////reg
if request("action")="reg" then

	username=SQLCheck(request("username"))
	password=SQLCheck(request("password"))
	key_reg=ucase(SQLCheck(request("reg")))
	
	if username="" or password="" then
		connclose
		geterror "请完整填写相关信息！","reg.asp"
	end if
	
	key_reg=replace(key_reg," ","")
	key_reg=trim(replace(key_reg,vbcrlf,""))
	
	password=md5(password,16)
	
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select admin_id from sys_admin_list where admin_name='sysadmin' and admin_password='"&password&"' and admin_open=1 ",conn,1,1
	
	if rs.eof or rs.bof then
		rs.close
		set rs=nothing
		connclose
		geterror "站长密码有误！","reg.asp"
	end if
	
	rs.close
	rs.open "select * from sys_reg order by reg_id ",conn,1,3
	if rs.eof or rs.bof then  rs.addnew()
	rs("reg_key_reg")=key_reg
	rs("reg_date")=now()
	rs.update
	rs.close
	set rs=nothing
	
	Application.Lock
	Application("FB_EM_1_SQL_reg_date") = ""
	Application.UnLock
	
	getinfo "注册码已经成功写入,点击下一步进行确认！如果注册码正确您将可以正常登陆系统，否则会有相关提示！","admin"

elseif  request("action")="try" then

	username=SQLCheck(request("username"))
	password=SQLCheck(request("password"))
	'username=request("username")
	'password=request("password")
	key_try=ucase(SQLCheck(request("try")))
	'response.write password
	'response.end
	if username="" or password="" or key_try="" then
		connclose
		geterror "请完整填写相关信息！","reg.asp"
	end if
	
	key_try=replace(key_try," ","")
	key_try=trim(replace(key_try,vbcrlf,""))
	
	password=md5(password,16)
	
	if len(key_try)<>1037 then
		connclose
		geterror "试用码应该为1037字节！","reg.asp"
	end if
	
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select admin_id from sys_admin_list where admin_name='"&username&"' and admin_password='"&password&"' and admin_open=1 ",conn,1,1
	
	if rs.eof or rs.bof then
		rs.close
		set rs=nothing
		connclose
		geterror "站长密码有误！","reg.asp"
	end if
	
	rs.close
	rs.open "select * from sys_reg order by reg_id ",conn,1,3
	if rs.eof or rs.bof then  rs.addnew()
	rs("reg_key_try")=key_try
	'rs("reg_date")=now()
	rs.update
	rs.close
	set rs=nothing
	
	Application.Lock
	'Application("FB_EM_1_SQL_reg_key_try") = str_rs_try
	Application("FB_EM_1_SQL_reg_key_try") = key_try
	'Application("FB_EM_1_SQL_reg_date") = now
	Application.UnLock
	
	getinfo "试用码已经成功写入,点击下一步进行确认！如果试用码正确您将可以正常登陆系统，否则会有相关提示！",""

end if
%>



<html>
<head>
<title>emart 系统注册</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body{
font-size:13px;
color:#000066;
weight:bold


}
p{
border-bottom:1px dotted #bebebe ;padding-bottom:8px;height:20px;
}
.style1 {color: #FF0000}
-->
</style>
</head>
<body bgcolor="#FFFFFF" >
<div id=ch style='width:100%;padding-top:10px;' align="center">

	<div style='width:500px;padding:10px;border:1px solid #bebebe' align="left">
		<p>
		  <input disabled id=sreg style='color:red;font-weight:bold' type=button value='我要注册！' onclick='document.getElementById("try").style.display="none";document.getElementById("reg").style.display="";document.getElementById("stry").disabled=0;document.getElementById("sreg").disabled=1'> 

		  <input type=button value='取得注册码！' onclick='alert("取得注册码步骤：\n 1.登陆我们的官方网站【http://www.freshbox.cn】 \n 2.选择一种联系方式与我们的销售人员取得联系 \n 3.确认购买并选择一种支付方式支付相应款项 \n 4.您将系统的序列号【即本页面中的系统序列号】提供给我们的客服人员，我们会帮您生成一个32位的注册码 \n 5.将【32位的注册码】复制到本页面中的相应栏中 \n 6.点击【开始注册】按钮即可！");window.open("http://www.freshbox.cn")'> 

		  <input id=stry type=button value='我要试用！' onclick='alert("您可以免费试用本系统【一个月】超过期限系统将无法使用，届时如果您希望继续使用本系统请选择注册！\n\n取得试用码步骤：\n 1.到我们的官方网站【http://www.freshbox.cn】\n 注册为会员 \n 2.在会员控制面板中选择【取得试用码】链接 \n 3.填入系统的序列号【即本页面中的系统序列号】 \n 4.点击【生成试用码】按钮\n 5.将生成的1037字节的试用码复制到本页面中的相应栏中 \n 6.点击开始试用按钮即可！");document.getElementById("reg").style.display="none";document.getElementById("try").style.display="";document.getElementById("sreg").disabled=0;document.getElementById("stry").disabled=1'> 
		  
		  <input type=button value='取得试用码！' onclick='alert("步骤：\n 1.到我们的官方网站【http://www.freshbox.cn】注册为会员 \n 2.在会员控制面板中选择【取得试用码】链接 \n 3.填入系统的序列号【即本页面中的系统序列号】 \n 4.点击【生成试用码】按钮\n 5.将生成的1037字节的试用码复制到本页面中的相应栏中 \n 6.点击开始试用按钮即可！");window.open("http://www.freshbox.cn")'> 
		</p>
		
	</div>
	
</div>



<div id=reg style='width:100%;padding-top:5px;' align="center">

	<form name="reg" method="post" action="reg.asp?action=reg" >
	<div style='width:500px;padding:10px;border:1px solid #bebebe' align="left">
		<p>
		  站 长 帐号：<input title="请填写站长的帐号"  maxLength="20" size="21" value="sysadmin" name="username"> 
		  站长密码：<input title="请填写站长的密码"  maxLength="20" size="23" type="password"  name="password"> 
		</p>
		
		<p>
		系统序列号：<input title="系统序列号"  maxLength="32" size="55" value="<%=Application("FB_EM_1_SQL_sys_mark")%>" name="mark">
		</p>
		
		<p id=reg >
<%
if Application("FB_EM_1_SQL_reg_key_reg")<>"" and not isnull(Application("FB_EM_1_SQL_reg_key_reg")) then 
regs=Left(Application("FB_EM_1_SQL_reg_key_reg"), Len(Application("FB_EM_1_SQL_reg_key_reg")) - 32)
else
regs=""
end if
%>
		  <nobr><font class="style1">系统注册码：</font><input name="reg" size=55 title="32位的注册码"  value="<%=regs%>"> </nobr>
	  </p>
	  
		<p  align=center>
		 <input type=submit  tabindex="0" style='color:red;font-weight:bold' value='开 始 注 册！' size=5 >
		</p>
		
	</div>

	</form>
	
</div>

<div id=try style='width:100%;display:none;	padding-top:5px;' align="center">

	<form name="try" method="post" action="reg.asp?action=try" >
	<div style='width:500px;padding:10px;border:1px solid #bebebe' align="left">
		<p>
		  站 长 帐号：<input title="请填写站长的帐号"  maxLength="20" size="21" value="sysadmin" name="username"> 
		  站长密码：<input title="请填写站长的密码"  maxLength="20" size="23" type="password"  name="password"> 
		</p>
		<p>
		系统序列号：<input title="系统序列号"  maxLength="32" size="55" value="<%=Application("FB_EM_1_SQL_sys_mark")%>" name="mark">
		</p>
		<p align=center>
		<textarea name="try" cols="65" rows="21" maxLength="1037" title="系统序列号"  value="<%=Application("FB_EM_1_SQL_sys_mark")%>"><%if Application("FB_EM_1_SQL_reg_key_try")<>"" then response.write Application("FB_EM_1_SQL_reg_key_try") else response.write "请在此处输入您在官方网站上获得的1037字节的试用码！"%></textarea>
		
		<input style='padding-top:5px;' type=submit value='开 始 试 用！' size=5 >
		</p>
		
	</div>

	</form>
	
</div>


</body>
</html>