<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%dim action
action=request.QueryString("action")%>
<html><head><title><%=webname%>--商家注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="image/css.css" rel="stylesheet" type="text/css">
<script language=JavaScript>
function IsDigit()
{
return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
</script>
<script language="JavaScript">
<!--
function checkuserinfo()
{
 if(checkspace(document.shjiainfo.shjianame.value)) {
	document.shjiainfo.shjianame.focus();
alert("对不起，请填写用户名！");
	return false;
}
if(checkspace(document.shjiainfo.name.value)) {
	document.shjiainfo.name.focus();
alert("对不起，请填写企业名称！");
	return false;
}
if(checkspace(document.shjiainfo.name2.value)) {
	document.shjiainfo.name2.focus();
alert("对不起，请填写企业负责人名称！");
	return false;
}
if(checkspace(document.shjiainfo.shjiapassword.value) || document.shjiainfo.shjiapassword.value.length < 6 || document.shjiainfo.shjiapassword.value.length >20) {
	document.shjiainfo.shjiapassword.focus();
alert("密码长度不能不能这空，在6位到20位之间，请重新输入！");
	return false;
}
if(document.shjiainfo.shjiapassword.value != document.shjiainfo.shjiapassword1.value) {
	document.shjiainfo.shjiapassword.focus();
	document.shjiainfo.shjiapassword.value = '';
	document.shjiainfo.shjiapassword1.value = '';
alert("两次输入的密码不同，请重新输入！");
	return false;
}

 if(document.shjiainfo.shjiaemail.value.length!=0)
{
if (document.shjiainfo.shjiaemail.value.charAt(0)=="." ||
 document.shjiainfo.shjiaemail.value.charAt(0)=="@"|| 
 document.shjiainfo.shjiaemail.value.indexOf('@', 0) == -1 || 
 document.shjiainfo.shjiaemail.value.indexOf('.', 0) == -1 || 
 document.shjiainfo.shjiaemail.value.lastIndexOf("@")==document.shjiainfo.shjiaemail.value.length-1 || 
 document.shjiainfo.shjiaemail.value.lastIndexOf(".")==document.shjiainfo.shjiaemail.value.length-1)
 {
alert("Email地址格式不正确！");
document.shjiainfo.shjiaemail.focus();
return false;
}
 }
 else
{
 alert("Email不能为空！");
 document.shjiainfo.shjiaemail.focus();
 return false;
 }
 if(checkspace(document.shjiainfo.quesion.value)) {
	document.shjiainfo.quesion.focus();
alert("对不起，请填写密码提问！");
	return false;
}
 if(checkspace(document.shjiainfo.answer.value)) {
	document.shjiainfo.answer.focus();
alert("对不起，请填写密码提问的答案！");
	return false;
}
}
function checkshouhuoxx()
{
 if(checkspace(document.shouhuoxx.userzhenshiname.value)) {
	document.shouhuoxx.userzhenshiname.focus();
alert("对不起，请填写真实姓名！");
	return false;
}
if(checkspace(document.shouhuoxx.shouhuodizhi.value)) {
	document.shouhuoxx.shouhuodizhi.focus();
alert("对不起，请填写收货人详细收货地址！");
	return false;
}
if(checkspace(document.shouhuoxx.youbian.value)) {
	document.shouhuoxx.youbian.focus();
alert("对不起，请填写邮编！");
	return false;
}
if(document.shouhuoxx.youbian.value.length!=6) {
	document.shouhuoxx.youbian.focus();
alert("对不起，请正确填写邮编！");
	return false;
} 
if(checkspace(document.shouhuoxx.usertel.value)) {
	document.shouhuoxx.usertel.focus();
alert("对不起，请留下您的联系电话！");
	return false;
} 
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
//-->
</script>
</head>
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from shop_Nclass order by Nclassidorder ",conn,1,1%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%count = 0
do while not rs.eof %>
subcat[<%=count%>] = new Array("<%= trim(rs("Nclass"))%>","<%= rs("anclassid")%>","<%= rs("Nclassid")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
		
onecount=<%=count%>;

function changelocation(locationid)
{
document.shjiainfo.Nclassid.length = 0; 

var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{ //这句不是很理解
 document.shjiainfo.Nclassid.options[document.shjiainfo.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onmouseover="window.status='<%=webname%>';return false">
<!--#include file="webtop.asp"-->
<%select case action
case ""%>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center" class="table-zuoyou table-shangxia">
<tr>
<td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="80%" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" align="center"><font color="#FF300"><strong>请用户仔细阅读<%=webname%>注册条约</strong></font></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="80%" border="0" align="center" cellpadding="10" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#ffffff">
<td><%call tiaoyue()%>
</td>
</tr>
</table></td>
</tr>
</table>
<table name=agree border="0" cellpadding="10" cellspacing="0" align=center width="80%">
<tr align=center>
<td width="50%" align="right"><form name=register method=post action=reg_shang.asp?action=yes>
<input type="hidden" name="action" value="agree">
<input class="go-wenbenkuang" type=submit value=" 同意注册 " name=Submit>
</form></td>
<td width="50%" align="left"><form action=index.asp method=post>
<input name="submit2" type=submit class=go-wenbenkuang value=" 我不同意 ">
</form></td>
</tr>
</table></td>
</tr>
</table>
<script>
secs = 60; // Number of secs to delay -CHINA-studio
wait = secs * 100;
document.forms.register.Submit.disabled =true;
for(i=1;i<=(wait/100);i++) {
		window.setTimeout("doUpdate(" + i + ")", i * 100);
	}
	window.setTimeout("Timer()", wait);

	function doUpdate(num) {
		if(num == (wait/100)) {
			document.forms.register.Submit.value = " 同意注册 ";
		} else {
			wut = (wait/100)-num;
			document.forms.register.Submit.value = " 同意前请先阅读 (" + wut + ")";
		}
	}
	function Timer() {
		document.forms.register.Submit.disabled =false;
}
</script>
<%case "yes"%>
<table width="760" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou table-shangxia" bordercolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF" bordercolor="#FFFFFF" align="center"><p><font color="#FF3300"><b>请您务必详细填写您的信息，并核对无误，国内用户请留下您的真实中文姓名。<br>
未经您的允许，您的个人信息对外保密。(带 <font color=red>**</font> 号为必填项) </b></font></p>
<form name=shjiainfo method=post action=reg_shang.asp?action=save>
<table width="80%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC" align="center">
<tr bgcolor="#FFFFFF">
<td colspan="2" valign="middle" bgcolor="#f1f1f1"><font color="#FF3300">&gt;&gt; 
商家联系信息</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="30%" align="right">请选择公司主营类别：</td>
<td width="70%" valign="middle"><%set rs=server.createobject("adodb.recordset")
rs.open "select * from shop_anclass order by anclassidorder",conn,1,1
if rs.eof and rs.bof then
response.write "请先添加主营项目。"
response.end
else%>
<select class="wenbenkuang" name="anclassid" size="1" id="select" onChange="changelocation(document.shjiainfo.anclassid.options[document.shjiainfo.anclassid.selectedIndex].value)">
<option selected value="<%=rs("anclassid")%>"><%=trim(rs("anclass"))%></option>
<%dim selclass
selclass=rs("anclassid")
rs.movenext
do while not rs.eof%>
<option value="<%=rs("anclassid")%>"><%=trim(rs("anclass"))%></option>
<%rs.movenext
loop
end if
rs.close%>
</select>
<font color=red>**</font> ->
<select class="wenbenkuang" name="Nclassid">
<%rs.open "select * from shop_Nclass where anclassid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then%>
<option selected value="<%=rs("NclassID")%>"><%=rs("Nclass")%></option>
<%rs.movenext
do while not rs.eof%>
<option value="<%=rs("NclassID")%>"><%=rs("Nclass")%></option>
<%rs.movenext
loop
end if
rs.close
set rs = nothing%>
</select>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">公司名称：</td>
<td valign="middle"><input class="wenbenkuang" name="name" type="text" id="name3" size="30" maxlength="18">
<font color=red>**</font> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">负 责 人：</td>
<td valign="middle"><input class="wenbenkuang" name="name2" type="text" id="name22" maxlength="10">
<font color=red>**</font> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">公司地址：</td>
<td valign="middle"><input class="wenbenkuang" name="dz" type="text"id="dz2" size="50" maxlength="40">
<font color=red>**</font> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">邮　　编：</td>
<td valign="middle"><input class="wenbenkuang" name="pc" type="text"id="pc" size="10" maxlength="6" onKeyPress="event.returnValue=IsDigit();">
<font color=red>**</font> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">电　　话：</td>
<td><input class="wenbenkuang" name="tel" type="text" id="tel" size="30" maxlength="30">
<font color=red>**</font> 区号-电话号码-分机号码</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">传　　真：</td>
<td valign="middle"><input class="wenbenkuang" name="fax" type="text" id="fax" size="30" maxlength="40">
可不埴</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">电子邮箱：</td>
<td valign="middle"><input class="wenbenkuang" name="shjiaemail" size="30" type="text" id="shjiaemail" maxlength="30">
<font color=red>**</font> 请填写有效的e-mail地址 </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">经营范围：</td>
<td valign="middle"><textarea name="content" cols="30" rows="3" class="wenbenkuang" id="content"></textarea>
<font color=red>**</font> 请填写公司所经营的产品范围 </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">网站类型：</td>
<td valign="middle"><input type=radio name=lx id=radio value=0 checked>默认A型为免费商家，如需要收费服务请联系0532-82924086</td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" valign="middle" bgcolor="#f1f1f1"><font color="#FF3300">&gt;&gt; 管理名称和密码</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">管理员名称：</td>
<td valign="middle"><input class="wenbenkuang" name="shjianame" type="text" id="shjianame2" maxlength="18">
<font color=red>** </font>用于登录后台管理 </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">管理员密码：</td>
<td valign="middle"><input class="wenbenkuang" name="shjiapassword" type="password" id="shjiapassword2" maxlength="18">
<font color=red>**</font> 长度必须是6-20个字符只能为英语字、数字</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" valign="middle">确认管理员密码：</td>
<td valign="middle"><input class="wenbenkuang" name="shjiapassword1" type="password" id="shjiapassword12" maxlength="18">
<font color=red>**</font> 请将输入的密码再次输入，以免设置密码出错。</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width=20% align="right"></td>
<td><input class="go-wenbenkuang" onClick="return checkuserinfo();" type="submit" name="submit" value=" 提交信息 ">
<input class="go-wenbenkuang" onClick="ClearReset()" type="reset" name="Clear" value=" 重新填写 ">
</td>
</tr>
</table>
</form></td>
</tr>
</table>
<%case "save"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where useremail='"&trim(request("shjiaemail"))&"' or username='"&trim(request("shjianame"))&"' or name='"&trim(request("name"))&"'",conn,1,1
if rs.recordcount>0 then
call usererr()
rs.close
else
rs.close

set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia]",conn,1,3
rs.addnew
rs("anclassid")=int(request("anclassid")) '大类
'rs("nclassid")=int(request("nclassid")) '小类
rs("username")=trim(request("shjianame"))
rs("userpassword")=md5(trim(request("shjiapassword")))
rs("useremail")=trim(request("shjiaemail"))
rs("name")=trim(request("name"))'商家名称
rs("name2")=trim(request("name2"))'负责人
rs("dz")=trim(request("dz"))'公司地址
rs("pc")=trim(request("pc"))'邮编
rs("tel")=trim(request("tel"))'电话
rs("fax")=trim(request("fax"))'传真
rs("lx")=trim(request("lx"))'网站类型
rs("content")=trim(request("content"))
rs("flag")=2

rs("adddate")=now()
rs("lastlogin")=now()
'rs("logins")=1
'rs("zhifufangshi")=0
'rs("songhuofangshi")=0
'rs("reglx")=1
'rs("jifen")=0
rs("logo")="image/logo.gif"
rs("jiaoyijine")=0
rs("sex")=1
rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")

rs.update

response.Cookies("godbook")("shjianame")=trim(request("username"))
response.Cookies("godbook")("shjiaid")=rs("shjiaid")
session("shjianame")=rs("name")
session("shjiaid")=rs("shjiaid")

rs.close
set rs=nothing
set rs=conn.execute("select top 1 shjiaid from [shjia] order by shjiaid desc")
shjiaid=rs(0)

session("regtimes")=1
session.Timeout=1

set rs=server.CreateObject("adodb.recordset")
rs.Open "select mailaddress,mailusername,mailuserpass,mailname,mailsend from shop_config",conn,1,1
mailaddress=rs("mailaddress")
mailusername=rs("mailusername")
mailuserpass=rs("mailuserpass")
mailname=rs("mailname")
mailsend=rs("mailsend")
rs.close
set rs=nothing

'发送邮件
	on error resume next
	'发送注册邮件
	topic="您在" & webname & "的加盟注册资料"
	getpass=trim(request("shjiapassword"))
	
	mailbody="<html>"
	mailbody=mailbody & "<title>加盟注册信息</title>"
	mailbody=mailbody & "<body>"
	mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
	mailbody=mailbody & "<TD valign=middle align=top>"
	mailbody=mailbody & trim(request("shjianame"))&"，您好：<br><br>"
	mailbody=mailbody & "欢迎您加盟" & webname & "IT532商频网，我们将提供给您最好的服务！<br>"
	mailbody=mailbody & "下面是您的注册信息：<br><br>"
	mailbody=mailbody & "注册名："&trim(request("shjianame"))&"<br>"
	mailbody=mailbody & "密码："&getpass&"<br>"
	mailbody=mailbody & "<br><br>"
	mailbody=mailbody & "<center><font color=red>再次感谢您加盟" & webname & "IT大青岛！</font>"
	mailbody=mailbody & "</TD></TR></TBODY></TABLE><br><hr width=95% size=1>"
	mailbody=mailbody & "</body>"
	mailbody=mailbody & "</html>"
	
Set JMail=Server.CreateObject("JMail.Message")
	JMail.Charset="gb2312"
	JMail.ContentType = "text/html"
jmail.from = mailsend
jmail.silent = true
jmail.Logging = true
jmail.FromName = mailname
jmail.mailserverusername = mailusername
jmail.mailserverpassword = mailuserpass
jmail.AddRecipient trim(request("shjiaemail"))
jmail.body=mailbody
JMail.Subject=topic
if not jmail.Send ( mailaddress ) then
SendMail=""
else
SendMail="OK"
end if
	if SendMail="OK" then
	sendmsg="<li>您的加盟注册信息已经发往您的邮箱，请注意查收。</li>"
	else
	sendmsg="<li>由于系统错误，给您发送的加盟注册资料未成功。</li>"
	end if

response.Write "<table width=760 border=0 cellspacing=0 cellpadding=0 align=center class='table-zuoyou table-shangxia' bordercolor=#ffffff><tr><td bordercolor=#FFFFFF bgcolor=#FFFFFF height=260>"
response.Write "<table width=70% border=0 align=center cellpadding=0 cellspacing=0><tr><td height=80 class=pad><font color=#ff3300>商家加盟注册成功!</font><br>"
response.Write "<li>恭喜您已注册成为["&webname&"]商家，请记好您的管理名及密码</li><br><li>您的网站已经开通，<a href='user/index.asp?shjiaid="&session("shjaiid")&"'><font color=red>点击这里</font></a>进入您的站点进行管理。</li><br><li>在1个月之内没有登录或者没有添加产品的，站点将自动关闭，需要进入要重新申请账号。</li><br>"
response.Write sendmsg&"<br>"
response.Write "<li><a href=index.asp>返回首页</a></li></td></tr></table></td></tr></table>"
end if%>

<%call saveuser()%>
<%sub tiaoyue()
set rs=server.CreateObject("adodb.recordset")
rs.Open "select regtiaoyue2 from shop_config",conn,1,1
response.Write trim(rs("regtiaoyue2"))
rs.Close
set rs=nothing
end sub

sub saveuser()
'if session("regtimes")=1 then
'response.Write "<table width=760 border=1 cellspacing=0 cellpadding=0 align=center bordercolor=#EDECEC><tr> <tdbordercolor=#FFFFFF bgcolor=#FFFFFF align=center> <br><font color=red>·对不起，您刚注册过用户。</font><br><font color=red >·请稍后再进行注册！</font><br><br><br></td></tr></table> "
'response.End
'end if
end sub

sub usererr()
response.write "<table width=760 border=0 cellspacing=0 cellpadding=0 align=center class='table-zuoyou table-shangxia 'bordercolor=#ffffff><tr>"
response.write "<td bordercolor=#FFFFFF bgcolor=#FFFFFF align=center height=260><table width=70% border=0 align=center cellpadding=2 cellspacing=0><tr><td class=pad><font color=#ff3300>· 商家加盟注册失败</font></td></tr><tr>"
response.write "<td class=pad><font color=#ff3300>· 您输入的用户名或e-mail地址或管理员名称已存在，请返回重新输入！<br>· <a href=javascript:history.go(-1)><font color=#ff3300>点击返回上一页</font></a> </font></td></tr></table></td></tr></table>"
end sub%>
<%end select%>
<!--#include file="service.asp"-->
<!--#include file="copyright.asp"-->
</body>
</html>