<!--#include file="../Include/Class_Conn.asp" -->
<!--#include file="../Include/Class_Main.asp" -->
<!--#include file="../Include/Class_Pass.asp" -->
<% 
'地区分站参数
Dim c_City,c_Name
If Session("c_City") = "" Then 
 Response.Redirect "../Index.asp"
 Response.End()
End if
c_City = Session("c_City")
c_Name = Session("c_Name")

'//定义变量
Dim Rs,SQL,Tmp(3)
Dim UserName,Schid,Password,Email,Question,Answer
Dim SchoolName,Properity,Set_Year,Reg_Currency,CurrencyType,Workers,School_Memo,ContactPerson
Dim Phone,Fax,Locus_Area,Locus_City,Address,ZipCode,WebHome,LastIp

LastIp = Request.Servervariables("Remote_Addr")
'//验证是否有同名用户或者同邮件的用户
UserName                     = Replace_Text(Request.Form("username"))
Password                     = Replace_Text(Request.Form("password"))
Password2					 = Password
Password                     = Md5(Password)
Schid                        = Replace_Text(Request.Form("Schid"))
Email                        = Replace_Text(Request.Form("email"))
Cityid						 = Replace_text(Request.Form("Cityid"))

Set Rs = Server.createobject("ADODB.recordset")
Rs.open "Select username,Email,Schid From [pH_School_Base] Where username='"&username&"' or Email='"&Email&"' or Schid='"&Schid&"'",conn,1,1
if not rs.eof or not rs.bof then
	if  rs("username")=username or rs("Schid")=Schid then
        CloseRs
        CloseDb
		response.write "<script >alert('"&Cls_WebName&" 提示：\n\n对不起，你的帐号已经使用了,请重新选择帐号并继续注册...');history.back(-1);</script>"
		response.end
    end if
    if rs("Email") = Email then
        CloseRs
        CloseDb
		response.write "<script >alert('"&Cls_WebName&" 提示：\n\n对不起，系统中有同名的邮箱,请重新选择邮箱并继续注册...');history.back(-1);</script>"
	  response.end
    end if

end if 
CloseRs

'//提交数据
Question                   = Replace_Text(Request.Form("Question"))
Answer                     = Replace_Text(Request.Form("Answer"))
SchoolName                 = Replace_Text(Request.Form("SchoolName"))
Properity                  = Replace_Text(Request.Form("Properity"))
Set_Year                   = Replace_Text(Request.Form("Set_Year"))
Reg_Currency               = Replace_Text(Request.Form("Reg_Currency"))
CurrencyType               = Replace_Text(Request.Form("CurrencyType"))
Workers                    = Replace_Text(Request.Form("Workers"))
School_Memo                = Replace_Text(Request.Form("School_Memo"))
ContactPerson              = Replace_Text(Request.Form("ContactPerson"))
Phone                      = Replace_Text(Request.Form("Phone"))
Fax                        = Replace_Text(Request.Form("Fax"))
Locus_Area                 = Replace_Text(Request.Form("x_suozaidi"))
Locus_City                 = Replace_Text(Request.Form("x_suozaidi1"))
Address                    = Replace_Text(Request.Form("Address"))
ZipCode                    = Replace_Text(Request.Form("ZipCode"))
WebHome                    = Replace_Text(Request.Form("WebHome"))


If School_Memo <> "" Then School_Memo = Replace(School_Memo,Chr(13),"<br>")
'//保存数据到数据库[pH_School_Base]表
SQL = "Insert Into [pH_School_Base] (Schid,Username,Password,Question,Answer,SchoolName,Properity,Set_Year,Reg_Currency,CurrencyType,Workers,School_Memo,ContactPerson,Phone,Fax,WebHome,ZipCode,Email,Address,Locus_Area,Locus_City,RegDate,LastIp,LastDate,LastUpdate_Time,LoginCount,VipFlag,ViewClicks,Websub,Cityid) Values ('"&Schid&"','"&Username&"','"&Password&"','"&Question&"','"&Answer&"','"&SchoolName&"',"&Properity&","&Set_Year&","&Reg_Currency&","&CurrencyType&","&Workers&",'"&School_Memo&"','"&ContactPerson&"','"&Phone&"','"&Fax&"','"&WebHome&"','"&ZipCode&"','"&Email&"','"&Address&"','"&Locus_Area&"','"&Locus_City&"',getdate(),'"&LastIp&"',getdate(),getdate(),1,0,0,'www',"&Cityid&")"
Conn.Execute(SQL)  '//[pH_School_Base]表

'//登陆
Tmp(0) = Username
Tmp(1) = Password
Tmp(2) = Schid
Session("School") = Tmp
Session("Server") = Request.ServerVariables("Server_Name")
'//关闭数据库连接参数
CloseDB
'//发送邮件给会员
Set Fso = Server.CreateObject("Scripting.FileSystemObject") '///打开文件
Set FileAll = Fso.OpenTextFile(server.mappath("Mail_Register.htm"), 1)
HtmlStr = FileAll.ReadAll
HtmlStr = Replace(HtmlStr,"Html_Username",Username)
HtmlStr = Replace(HtmlStr,"Html_Password",Password2)
Set Fso = Nothing
Call SendEmail(Email,HtmlStr,"您的帐号注册成功")
'//注册结束
Response.Write "<meta http-equiv=refresh content=""5;URL=User_Center.asp"">"
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../Css/Css.css" type=text/css rel=stylesheet>
<title><%= Cls_WebName&" | "&c_Name&"站" %> -- 院校会员注册</title>
</head>

<body>
<p>&nbsp;</p><table width="80%" border="0" align="center" cellspacing="1" bgcolor="#eeeeee">
  <tr> 
    <td height="100" bgcolor="f5f5f5"><table width="90%" border="0" align="center" cellspacing="0" class="text01">
        <tr> 
          <td height="30" align="center">你已经成功地注册成为<font color="#FF0000"><%= Cls_WebName %></font>的企业会员 进入<a href="User_Center.asp">院校管理平台</a></td>
        </tr>
        <tr> 
          <td height="3" bgcolor="ff6600"></td>
        </tr>
        <tr> 
          <td height="30" align="center"><font color=#999999>如果不能跳转，请点击这里进入<a href="User_Center.asp"><font color=#999999>院校管理平台</font></a></font></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
