<!-- #include file="conn.asp" -->
<!-- #include file="inc.asp" -->
<%
Username=Request.Form("Username")
Username=replace(Username," ","")
Username=replace(Username,"'","")
Username=replace(Username,"&","")
Password=Request.Form("Password")
 iname=trim(request.form("iname"))
 tel=trim(request.form("tel"))
 add=trim(request.form("add"))
 content=trim(request.form("content"))
 types=request.form("types")
 infoid=request.form("infoid")
 if iname="" then iname="-" end if
 if tid="" then tid=0 end if
 if tel="" then tel="-" end if
 if add="" then add="-" end if
if content="" then content="无" end if
 
if types=0 then
set rs= Server.CreateObject("ADODB.Recordset") 
sql="select * from teacher where Username='"&Username&"' and Password='"&Password&"' "
rs.open sql,conn,1,1
if rs.eof then
response.write"<SCRIPT language=JavaScript>alert('密码错误!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
elseif rs("iname")="-" then
session("Tch_ID")=makeid("tch","out",rs("id"))
response.write"<SCRIPT language=JavaScript>alert('你还没有发布简历，请发布后再申请!');"
response.write"this.location.href='tch_mod.asp';</SCRIPT>"
response.end
else
session("Tch_ID")=makeid("tch","out",rs("id"))
Conn.Execute("Update teacher Set star=star+1,idate=now() Where id="&makeid("tch","in",Session("Tch_ID")))
Conn.Execute("Insert Into reply (infoid,tid,types,content,idate) values("&makeid("stu","in",infoid)&","&makeid("tch","in",session("Tch_ID"))&",'"&types&"','"&content&"',now())")
response.write"<SCRIPT language=JavaScript>alert('在线申请成功!');"
response.write"this.location.href='index.asp';</SCRIPT>" 
response.end
end if
rs.close
set rs=nothing
else
Conn.Execute("Insert Into reply (infoid,iname,tel,add,types,content,idate) values("&makeid("tch","in",infoid)&",'"&iname&"','"&tel&"','"&add&"','"&types&"','"&content&"',now())")
response.write"<SCRIPT language=JavaScript>alert('在线预约成功!');"
response.write"this.location.href='index.asp';</SCRIPT>" 
response.end
end if
'conn.close 
'set conn=nothing 
%>
 