<!--#include file="inc/config.asp" -->
<!--#include file="inc/conn.asp" -->
<!--#include file="inc/function.asp" -->
<!--#include file="uc_api/uc_client/client.asp"-->
<!--#include file="inc/sql_filter.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>企业会员注册</title>
<link href="style/global.css" rel="stylesheet" type="text/css" />
<link href="member/style/member.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.pad_5{ padding:0px 0px 0px 5px;}
</style>
<script type="text/javascript" src="/js/common.js"></script>
<script src="js/reg.js" type="text/javascript"></script>
<script src="js/industrys.js" type="text/javascript"></script>
<script src="js/areas.js" type="text/javascript"></script>
<script type="text/javascript" src="js/http.js"></script>
</head>
<body>
<!--#include file="templet/head.htm" -->
<%
dim act,gourl,Mobile

act=request.QueryString("act")
gourl=request.QueryString("gourl")
if(request.QueryString("gourl")<>"") then
	gourl=request.QueryString("gourl")
elseif(request.ServerVariables("HTTP_REFERER")<>"") then
	gourl=request.ServerVariables("HTTP_REFERER")
else
	gourl="/"
end if
if(act<>"" and act="reg") then
	if(isSelfRefer()) then
	else
		call alertstr("禁止外部提交",2)
	end if
	dim rs,UserName,PassWord,RePassWord,Email,ForAsk,ForAnswer,CheckCode,UIP,IsExits,channelid
	UserName=replaceBadChar(request.Form("UserName"))
	PassWord=trim(request.Form("PassWord"))
	RePassWord=trim(request.Form("RePassWord"))	
	Email=replaceBadChar(request.Form("Email"))
	ForAsk=replaceBadChar(request.Form("ForAsk"))
	ForAnswer=replaceBadChar(request.Form("ForAnswer"))
	CheckCode=request.Form("CheckCode")
	if CheckCode <> CStr(Session("GetCode"))  then 
		call alertstr("错误：\n验证码错误",1)
	end if
	if CheckCode= "" then
		call alertstr("错误：\n验证码错误",1)
	elseif Session("GetCode") = "9999" then
		Session("GetCode")=""
	elseif Session("GetCode") = "" then
		call alertstr("错误：\n验证码错误",1)
	elseif cstr(Session("GetCode"))<>cstr(Trim(CheckCode)) then
		call alertstr("错误：\n您输入的确认码和系统产生的不一致，请重新输入。\n返回后请刷新登录页面后重新输入正确的信息",2)		
	end if
	Session("GetCode")=""
	if(BindUc=true) then
		'在UCenter注册用户信息
		uc_uid = uc_user_register(username,password,email)
		uc_uid =Clng(uc_uid)
		if(uc_uid <= 0) Then 
			if(uc_uid = -1) Then  
				call alertstr("用户名不合法",1)
			 elseif(uc_uid = -2) Then
				call alertstr("包含要允许注册的词语",1)
			 elseif(uc_uid = -3) Then
				call alertstr("用户名已经存在",1)
			 elseif(uc_uid = -4) Then
				call alertstr("Email 格式有误",1)
			 elseif(uc_uid = -5) Then
				call alertstr("Email 不允许注册",1)
			 elseif(uc_uid = -6) Then
				call alertstr("该 Email 已经被注册",1)
			 else 
				'call alertstr("未定义",1)
			End if
		 else 
			'注册成功，设置 Cookie，加密直接用 uc_authcode 函数，用户使用自己的函数			
		End If
	end if
	PassWord=Php_MD5(PassWord)
	UIP=GetIp()
	dim ComType,ComName,ParentId,IndustryId,CreateDate,ContactMan,Province,City,BusinessScope,Tel,Fax,Address,PostCode,HomePage,Demons
	ComType=replaceBadChar(request.Form("ComType"))
	ComName=request.Form("ComName")
	if(len(ComName)<2) then
		call alertstr("错误：\n企业名称不能为空",1)
	end if
	ParentId=request.Form("ParentId")
	if(ParentId<>"") then
		ParentId=Cint(ParentId)
	else
		ParentId=0
	end if
	IndustryId=request.Form("IndustryId")
	if(IndustryId<>"") then
		IndustryId=Cint(IndustryId)
	else
		IndustryId=0
	end if	
	CreateDate=replaceBadChar(request.Form("CreateDate"))
	ContactMan=replaceBadChar(request.Form("ContactMan"))
	Province=request.Form("Province")
	if(Province<>"") then
		Province=Clng(Province)
	else
		Province=0
	end if	
	City=request.Form("City")
	if(City<>"") then
		City=Clng(City)
	else
		City=0
	end if	
	BusinessScope=replaceBadChar(request.Form("BusinessScope"))
	BusinessScope=left(BusinessScope,120)
	Tel=replaceBadChar(request.Form("Tel"))
	Fax=replaceBadChar(request.Form("Fax"))
	Address=replaceBadChar(request.Form("Address"))
	PostCode=replaceBadChar(request.Form("PostCode"))
	HomePage=replaceBadChar(request.Form("HomePage"))
	Demons=replaceBadChar(request.Form("Demons"))
	channelid=Cint(request.Form("channelid"))
	if(request.Form("Mobile")<>"") then
		Mobile=request.Form("Mobile")
	end if
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_member_e where UserId='"&UserName&"' or Email='"&Email&"'",conn,3,3
	if not rs.eof then
		IsExits=true
	else
		rs.addnew
		rs("UserId")=UserName
		rs("Email")=Email
		rs("UserName")=ComName
		rs("ParentId")=ParentId
		rs("IndustryId")=IndustryId
		rs("ComType")=ComType
		rs("CreateDate")=CreateDate
		rs("ContactMan")=ContactMan
		rs("Province")=Province
		rs("City")=City
		rs("BusinessScope")=BusinessScope
		rs("Tel")=Tel
		rs("Fax")=Fax

		rs("Mobile")=Mobile
		rs("QQ")=""
		rs("HomePage")=HomePage
		rs("Address")=Address
		rs("PostCode")=PostCode
		rs("Photo")=request.Form("Photo")
		rs("Demons")=Demons		
		rs.update
		IsExits=false
	end if
	rs.close
	set rs=nothing
	if (IsExits=false) then
		set rs=server.CreateObject("adodb.recordset")
		rs.open "select * from t_member where UserId='"&UserName&"'",conn,3,3
		if(rs.eof or rs.bof) then
			rs.addnew
			rs("UserType")=1
			rs("UserId")=UserName
			rs("UserPass")=PassWord			
			rs("PassAsk")=ForAsk
			rs("PassAnswer")=ForAnswer	
			rs("Email")=Email		
			rs("RegIp")=UIP
			rs("RegDate")=now()			
			rs("LoginNum")=0
			rs("LastLoginIp")=UIP
			rs("LastLoginDate")=now()
			rs("IsLocked")=0
			rs("GoldMoney")=0.00
			rs("Score")=100
			rs("IsCheck")=1
			rs("UserLevel")=0
			rs("ChannelId")=channelid
			rs.update
		end if
		rs.close
		set rs=nothing
		session("TotCms_UserName")=UserName
		session("TotCms_UserPass")=PassWord
		session("TotCms_UserType")=1
		session("TotCms_UserId")=UserName
				
		'Response.Cookies("TotCms_Cookie")("UserName")=UserName
		'Response.Cookies("TotCms_Cookie")("UserPass")=PassWord
		'Response.Cookies("TotCms_Cookie")("LastVisite")=now()
		'Response.Cookies("TotBbs_Cookie").path="/"
		'Response.Cookies("TotCms_Cookie").Domain=CookieUrl
		'Response.Cookies("TotCms_Cookie").Expires=Date()+1
		response.Write("<p align=""center""><font color=""#FF0000"" size=""4"">恭喜您，成功注册新企业用户！</font></p>")
		response.Redirect("/member/dsnt_api.asp?username="&UserName&"&userpass="&request.Form("PassWord")&"&email="&Email)
		response.Write("<meta http-equiv=""Refresh"" content=""1;URL="&gourl&""" />")
	else

		Response.Write("<script>alert(""此用户或邮箱已存在，请换一个用户名或邮箱试试!"");history.back();</script>")		
	end if
else
%>
<form id="form1" name="form1" method="post" action="?act=reg&gourl=<%=server.URLEncode(gourl)%>" onsubmit="return check(this)">
  <table width="960" align="center" cellpadding="0" cellspacing="1" bgcolor="#fff0cf" class="tableborder">
    <tr align="middle">
      <th colspan="2" class="pad_10">企业会员注册</th>
    </tr>
    <tr>
      <td height="22" colspan="2" bgcolor="#FFFFFF" class="pformleft">★请仔细填写下面注册信息</td>
    </tr>
    <tr>
      <td width="38%" bgcolor="#FFFFFF" class="pad_5">用户名：<br />
        注册用户名长度限制为2－20字符</td>
      <td width="62%" bgcolor="#FFFFFF" class="pformleft"><input name="UserName" id="UserName" size="30" maxlength="20" onblur="checkUser(this)" />
        (<span class="style3">*</span>)<span id="userMsg"></span></td>
    </tr>        
    <tr>
      <td width="38%" bgcolor="#FFFFFF" class="pad_5">帐号密码(至少4位)：<br />
        请输入密码，区分大小写。<br />
        请不要使用任何类似   '*'、' ' 或 HTML 字符</td>
      <td width="62%" bgcolor="#FFFFFF" class="pformleft"><input name="PassWord" type="password" id="PassWord" value="" size="30" maxlength="16" />
      (<span class="style3">*</span>)</td>
    </tr>
    <tr>
      <td width="38%" bgcolor="#FFFFFF" class="pad_5">确认密码(至少4位)：<br />
        请再输一遍确认</td>
      <td bgcolor="#FFFFFF" class="pformleft"><input name="RePassWord" type="password" id="RePassWord" value="" size="30" maxlength="16" />
      (<span class="style3">*</span>)</td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="pad_5">密码问题：<br />
        忘记密码的提示问题</td>
      <td bgcolor="#FFFFFF" class="pformleft"><input name="ForAsk" id="ForAsk" size="30" /></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="pad_5">问题答案：<br />
        忘记密码的提示问题答案，用于取回密码</td>
      <td bgcolor="#FFFFFF" class="pformleft"><input name="ForAnswer" id="ForAnswer" size="30" /></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="pad_5">Email地址：<br />
        请输入有效的邮件地址</td>
      <td bgcolor="#FFFFFF" class="pformleft"><input name="Email" id="Email" size="30" maxlength="50" onblur="checkEmailExits(this)" />          
      (<span class="style3">*</span>)
	  <span id="emailMsg"></span></td>
    </tr>
    <tr>
      <td height="32" colspan="2" bgcolor="#FFFFFF" class="pad_5">以下企业资料信息选择填写，注册成功后您可以从会员控制面板修改。</td>
    </tr>
    
    <tr>
      <td height="32" bgcolor="#FFFFFF" class="pad_5">企业名称：</td>
      <td bgcolor="#FFFFFF" class="pformleft"><input name="ComName" type="text" id="ComName" size="30" maxlength="50" />          
      (<span class="style3">*</span>)</td>
    </tr>
    <tr>
      <td height="32" bgcolor="#FFFFFF" class="pad_5">公司图片：</td>
      <td bgcolor="#FFFFFF" class="pformleft"><input name="Photo" type="text" id="Photo" size="50" value=""></td>
    </tr>
    <tr>
      <td height="32" bgcolor="#FFFFFF" class="pad_5">企业性质：</td>
    <td bgcolor="#FFFFFF" class="pformleft"><select name="ComType" id="ComType">
      <option value="个体经营">个体经营</option>
      <option value="企业单位" selected="selected">企业单位</option>
      <option value="事业单位或社会团体">事业单位或社会团体</option>
          </select></td>
    </tr> 
      
	  <tr>
	    <td height="32" bgcolor="#FFFFFF" class="pad_5">选择行业：</td>
	    <td bgcolor="#FFFFFF" class="pformleft">
      <select name="ParentId" id="ParentId" onchange="GetIndustryChilds(this.options[this.selectedIndex].value,0,'IndustryId')">
        <option value="0">一级行业分类</option>
        <script>document.write(GetIndustryFirst(0,''));</script>
      </select>
      <select name="IndustryId" id="IndustryId">
        <option value="0">二级行业分类</option>
      </select>
      </td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">成立日期：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><input type="text" name="CreateDate" id="CreateDate" /></td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">联系人：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><input type="text" name="ContactMan" id="ContactMan" /></td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">手机号：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><input type="text" name="Mobile" id="Mobile" /></td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">地区：</td>
	    <td bgcolor="#FFFFFF" class="pformleft">
      <select name="Province" id="Province" onchange="GetChilds(this.options[this.selectedIndex].value,0,'City')">
        <option value="0">选择城市</option>
        <script>document.write(GetFirst(0,''));</script>
      </select>
      <select name="City" id="City">
        <option value="0">选择地区</option>
      </select>	
      </td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">经营范围：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><textarea name="BusinessScope" id="BusinessScope" cols="45" rows="5"></textarea></td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">电话：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><input type="text" name="Tel" id="Tel" /></td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">传真：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><input type="text" name="Fax" id="Fax" /></td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">地址：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><input type="text" name="Address" id="Address" /></td>
    </tr>
    <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">邮编：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><input type="text" name="PostCode" id="PostCode" /></td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">网址：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><input name="HomePage" type="text" id="HomePage" size="50" /></td>
    </tr>
	  <tr>
	    <td bgcolor="#FFFFFF" class="pad_5">公司简介：</td>
	    <td bgcolor="#FFFFFF" class="pformleft"><textarea name="Demons" id="Demons" cols="45" rows="5"></textarea></td>
    </tr>
	  <tr>
      <td width="38%" bgcolor="#FFFFFF" class="pad_5">请输入验证码：</td>
    <td width="62%" bgcolor="#FFFFFF" class="pformleft">
          <input size="5" name="CheckCode" />          
          <% = GetCode() %>
          (<span class="style3">*</span>)</td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#FFFFFF" class="row4"><div align="center">
        <input type="hidden" name="channelid" value="1" />
        <input type="submit" name="Submit" value="注 册" />
        <input type="reset" name="Submit2" value="重 写" />
      </div></td>
    </tr>
  </table>
</form>
<%
	end if
%>
<!--#include file="templet/root.htm" -->
</body>
</html>
<%
call connclose()
%>