<%@ codepage ="936" %>
<!--#include file="conn.asp"-->
<!--#include file="inc.asp"-->
<%
types=Request.Form("types")
username=Trim(Request.Form("username"))
username=Replace(username,",","")
username=Replace(username,"'","")
username=Replace(username,"&","")
username=Replace(username,";","")
password=Trim(Request.Form("password"))
ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
If ip = "" Then ip = Request.ServerVariables("REMOTE_ADDR") 
If Request.Form("Type_Num")=1 Then
Set Rs=server.CreateObject ("adodb.recordset")
Sql="Select * From agent Where username='"&username&"'"
Rs.Open Sql,Conn,1,3
If Not Rs.Eof Then
Response.Write"<SCRIPT language=JavaScript>alert('该户名已经存在，请重新填写用户名。');"
Response.Write"javascript:history.go(-1)</SCRIPT>"
Response.End
Else
Rs.Addnew
Rs("username")=username
Rs("password")=password
Rs("company")="-"
Rs("content")="无"
Rs("iname")="-"
Rs("tel")="-"
Rs("fax")="-"
Rs("email")="-"
Rs("address")="-"
Rs("city")=City_ID
Rs("pas")=0
Rs("qq")=0
Rs("regdate")=now()
Rs("idate")=now()
Rs("ip")=ip
Rs("regip")=ip
Rs("hit")=0
Rs.Update
Session("Agent_ID")=Rs("id")
Rs.Close
Set Rs=Nothing
Conn.Close
Set Conn=Nothing
Response.Write"<SCRIPT language=JavaScript>alert('恭喜您!成为武汉家教网的注册中介会员！');"
Response.Write"this.location.href='agent_mod.asp';</SCRIPT>" 
Response.End
End if
Else
set Rs=server.CreateObject ("adodb.recordset")
Sql="Select * From teacher Where username='"&username&"'"
Rs.Open Sql,Conn,1,3
If Not Rs.Eof Then
Response.Write"<SCRIPT language=JavaScript>alert('该户名已经存在，请重新填写用户名。');"
Response.Write"javascript:history.go(-1)</SCRIPT>"
Response.End
Else
Rs.Addnew
Rs("username")=username
Rs("password")=password
Rs("iname")="-"
Rs("sex")="-"
Rs("school")="-"
Rs("tschool")="-"
Rs("shenfen")="-"
Rs("spec")="-"
Rs("edu")="-"
Rs("teach")="-"
Rs("tage")="-"
Rs("mob")="-"
Rs("tel")="-"
Rs("email")="-"
Rs("qq")=0
Rs("ttime")="不限"
Rs("tarea")="不限"
Rs("content")="无"
Rs("pay")="面议"
Rs("types")=types
Rs("pas")=0
Rs("hit")=0
Rs("color_num")=0
Rs("color_value")="-"
Rs("top_num")=0
Rs("top_used")=0
Rs("index_num")=0
Rs("jjb")=100
Rs("star")=2
Rs("city")=City_ID
Rs("ip")=ip
Rs("regip")=ip
Rs("regdate")=now()
Rs("idate")=now()
Rs.Update
Session("Tch_ID")=makeid("tch","out",Rs("id"))
Rs.Close
Set Rs=nothing
Conn.Close
Set Conn=Nothing
Response.write"<SCRIPT language=JavaScript>alert('恭喜您!成为武汉家教网的注册会员！');"
Response.write"this.location.href='tch_mod.asp';</SCRIPT>" 
Response.end
End If
End If
%>