
<!--#INCLUDE FILE="fupload.inc"-->
<!--#include file="SQLconn.asp"-->


<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" Then
'---------------------------
'response.write "¿ªÊ¼·¢ËÍ<br>"
'---------------------------
Dim Fields
UploadSizeLimit=21212121
Set Fields = GetUpload()
dim Field
For Each Field In Fields.Items
if Field.name="teacher" then teacher=BinaryToString(Field.value)
if Field.name="content" then content=BinaryToString(Field.value)

next


 set rscheck=server.createobject("adodb.recordset")
      rscheckSQL="select * from teachers where TName ='"&teacher&"'" 
      rscheck.open rscheckSQL,conn,1,3
	  if  rscheck.eof and  rscheck.bof then
	      response.redirect   "FindError.asp?tname="&teacher
	  end if 
 
     set rsstudent=server.createobject("adodb.recordset")
      rsstudentSQL="select * from students where tongyibianhao='"&request.cookies("tongyibianhao")&"'  and years=(select vname from varset where  name='nowxueqi')" 
      rsstudent.open rsstudentSQL,conn,1,3
	  
	  

set rszhuti=server.createobject("adodb.recordset")
rszhutisql="select * from studentBBS where (bid is null)" 

rszhuti.open rszhutisql,conn,1,3
rszhuti.addnew
rszhuti("SendTo")=teacher
rszhuti("content")=content
rszhuti("tongyibianhao")=request.cookies("tongyibianhao")
rszhuti("grade")=rsstudent("grade")
rszhuti("class")=rsstudent("class")
rszhuti("Studentname")=rsstudent("Uname")
rszhuti("Studentdatetime")=now()
strip=Request.ServerVariables("REMOTE_ADDR")
rszhuti("StudentIp")=strip
rszhuti("teacher")=""



rszhuti.update
rszhuti.close




end if

 response.redirect   "AddBBS.asp"
%>


