⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index_question.asp

📁 网络教学管理系统
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
body {
	background-color: #B1DB99;
}
-->
</style>
<!--#include file = "inc/conn.asp" -->
<!--#include file = "CheckLogin.asp" -->
<!--#include file = "inc/zhuru.asp" -->
<%
	Dim strTeachingSujectID , strTeacherID , strSujectID ,strType
	strTeachingSujectID = Request.QueryString("TeachingSujectID")
	strTeacherID = Request.QueryString("TeacherID")
	strSujectID = Request.QueryString("SujectID")
	If strTeachingSujectID = "" Then
		Response.Write("参数错误!")
		Response.End
	End If
	If strTeacherID = "" Then
		Response.Write("参数错误!")
		Response.End
	End If
	If strSujectID = "" Then 
		Response.Write("参数错误!")
		Response.End
	End If
	
	strType = Request.QueryString("Type") 
	If strType = "Add" Then
		Dim rs1 ,strSql1 ,strTitle ,strContent ,strAskTime ,strStudentID
		strTitle = Request.Form("Title")
		strContent = Request.Form("Content")
		strAskTime = Now()
		Set rs1 = Server.CreateObject("ADODB.RecordSet")
		If Session("UserName") <> "" Then
			strSql1 = "SELECT ID FROM Student WHERE Name = '"& Session("UserName") &"'"
			rs1.open strSql1,conn,1,1
			If Not rs1.EOF Then
				strStudentID = rs1("ID").value
			Else
				strStudentID = ""
			End If
			rs1.Close
		Else
			strStudentID = ""
		End If
		strSql1 = "INSERT INTO Question (Title,StudentID,AskTime,Content,TeachingSujectID,TeacherID) Values('"& strTitle &"','"& strStudentID &"','"& strAskTime &"','"& strContent &"','"& strTeachingSujectID &"','"& strTeacherID &"')"
		rs1.open strSql1,conn,3,1
	End If	
		
	
%>
<%

	Dim rs ,strSql ,Num ,pageNum ,page ,loopNum
	If Session("UserType") = "学生" Then 
		strSql = "SELECT * FROM Question WHERE TeachingSujectID = " & strTeachingSujectID & "ORDER BY AskTime DESC"
	ElseIf Session("UserType") = "教师" Then
		strSql = "SELECT * FROM Question WHERE TeachingSujectID = " & strTeachingSujectID & "AND TeacherID = '"& strTeacherID &"' ORDER BY AskTime DESC"
	Else
		Response.Write("对不起,您没有权限进入此页面!")
		Response.End
	End If
	
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.open strSql,conn,1,1
	If Not rs.EOF Then
	
		
%>
</head>
<%
	If rs.recordcount > 0 Then
		rs.pagesize = 14
		Num = rs.recordcount
		pageNum = rs.pagecount
		page =  Request.QueryString("page")
		If page <> ""  Then
			page = Cint(page)
		ElseIf page < 1 Then
			page = 1
		Else
			page =1
		End If
		If page < 1 then
			page =1
		End If
		If page*rs.pagesize >Num and Not ((page-1)*rs.pagesize <Num) Then
			page = 1
		End If
		rs.absolutepage = page
		If page <> pageNum Then
			LoopNum = rs.pagesize
		Else
			LoopNum = Num - (page-1)*rs.pagesize
		End If
	
%>
<body topmargin="5" leftmargin="5">

<table width="690">
  <tr>
    <td colspan="4" align="center" background="images/liebiao.gif"><%
	If Session("UserType") = "学生" Then
%>
<a href="#a1">我要提问</a>
<%
	End If
%></td>
  </tr>
  <tr bgcolor="#66FF99">
    <td colspan="4" background="images/Down_bg.gif" bgcolor="#00CC00"><div align="center">总共找到<%=Num%>条记录&nbsp;<a href="index_Question.asp?page=1&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>">首页</a>&nbsp;<a href="index_Question.asp?page=<%=page-1%>&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>">上一页</a>&nbsp;<a href="index_Question.asp?page=<%=page+1%>&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>">下一页</a>&nbsp;<a href="index_Question.asp?page=<%=pageNum%>&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>">尾页</a>&nbsp;页次:<%=page%>/<%=pagenum%>&nbsp;共<%=pageNum%>页</div></td>
  </tr>
   <% For i = 1 to LoopNum %>
       <%
		Dim strStudentName
		If rs("StudentID") <> "" Then
			Set rs1 = Server.CreateObject("ADODB.RecordSet")
			strSql1 = "SELECT * FROM Student WHERE ID = " & rs("StudentID")
			rs1.open strSql1,conn,1,1
			If Not rs1.EOF Then
				strStudentName = rs1("Name").value
			Else
				strStudentName = ""
			End If
			rs1.close
			Set rs1 = Nothing
		Else
			strStudentName = ""
		End If
	%> 
	<%
  		Dim strTeacherName
		If rs("TeacherID") <> "" Then
			Set rs1 = Server.CreateObject("ADODB.RecordSet")
			strSql1 = "SELECT * FROM Teacher WHERE ID = " & rs("TeacherID")
			rs1.open strSql1,conn,1,1
			If Not rs1.EOF Then
				strTeacherName = rs1("Name").value
			Else
				strTeacherName = ""
			End If
			rs1.close
			Set rs1 = Nothing
		Else
			strTeacherName = ""
		End If
	%>
   
  <tr bgcolor="#72C479">
    <td width="250" bgcolor="#72C479" >&nbsp;疑问标题:<%=rs("Title").value%>&nbsp;&nbsp;&nbsp;</td>
    <td width="124" >提问学生:<a href="DetailStudent.asp?Name=<%=strStudentName%>"><%=strStudentName%></a>&nbsp;</td>
    <td width="173" >提问时间:<%=rs("AskTime").value%> </td>
    <td width="123" >&nbsp;&nbsp;<%If strTeacherName = Session("UserName") And Session("UserType") = "教师" Then %>
    &nbsp;&nbsp;<a href="Re_Question.asp?ID=<%=rs("ID").value%>&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>">回复</a>
    <%End IF%>
    <%If strTeacherName = Session("UserName") And Session("UserType") = "教师" Then %>
    <a href="DelQuestion.asp?ID=<%=rs("ID").value%>&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>" onclick='return confirm(&quot;您确定要删除此信息吗?&quot;)'>删除</a>
    <%End IF%></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td colspan="4" bgcolor="#FFFFFF"><Br>&nbsp;&nbsp;&nbsp;&nbsp;<%=rs("Content").value%><Br><Br><%If Session("UserName") <> strStudentName And  strStudentName <> "" Then%><div align="right"><a href="Add_Msg.asp?ManTo=<%=strStudentName%>">给<%=strStudentName%>发短信息</a>&nbsp;&nbsp;</div><%End If%></td>
  </tr>
  <%
  	If rs("Answer").value <> "" Then
  %>
  <tr bgcolor="#FFFFCC">
    <td colspan="4" bgcolor="#F5FFFB">&nbsp;<font color="#FF0000"><%=strTeacherName%>老师回复:</font><Br>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#FF0000"><%=rs("Answer").value%></font></td>
  </tr>
  <%
  	End If
  %>
    <%   rs.movenext 
  	Next %>
<tr bgcolor="#66FF99">
    <td colspan="4" background="images/Top_bg.gif" bgcolor="#00CC00"><div align="center">总共找到<%=Num%>条记录&nbsp;<a href="index_Question.asp?page=1&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>">首页</a>&nbsp;<a href="index_Question.asp?page=<%=page-1%>&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>">上一页</a>&nbsp;<a href="index_Question.asp?page=<%=page+1%>&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>">下一页</a>&nbsp;<a href="index_Question.asp?page=<%=pageNum%>&TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>">尾页</a>&nbsp;页次:<%=page%>/<%=pagenum%>&nbsp;共<%=pageNum%>页</div></td>
  </tr>
</table>
<%
		Else
			Response.Write("记录为空!")
		End If
	Else
		Response.Write("记录为空!")
	End If
%>
<%
	If Session("UserType") = "学生" Then
%><a name="a1">
<table width="378">
  <form id="form1" name="form1" method="post" action="Index_Question.asp?TeachingSujectID=<%=strTeachingSujectID%>&amp;TeacherID=<%=strTeacherID%>&amp;SujectID=<%=strSujectID%>&amp;Type=Add">
    <tr bgcolor="#66C06D">
      <td colspan="4" background="images/Down_bg.gif" bgcolor="#66C06D" ><div align="center">发表疑问</div></td>
    </tr>
    <tr bgcolor="#66C06D">
      <td width="67">疑问标题:</td>
      <td width="299" colspan="3"><input type="text" name="Title" />      </td>
    </tr>
    <tr bgcolor="#66C06D">
      <td colspan="4"><textarea name="Content" cols="50" rows="6"></textarea>      </td>
    </tr>
    <tr bgcolor="#66C06D">
      <td colspan="4" align="center"><input name="Submit2" type="reset" value="清空" /> &nbsp;&nbsp;<input type="submit" name="Submit" value="提交" /></td>
    </tr>
	    <tr >
      <td colspan="4" background="images/Top_bg.gif" bgcolor="#00CC00">&nbsp;</td>
    </tr>
  </form>
</table>
<%
	End If
%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -