<!--#include file="conn/conn_index.asp"-->
<!--#include file="inc/char.asp"-->
<!--#include file="inc/setup.asp"-->
<!--#include file="inc/sql.asp"-->
<%
	end if
	if Trim(Request.QueryString("action"))="save" then
		sid=ReplaceBadChar(int(Trim(Request.Form("sid"))))
		if sid="" then
			response.write"<SCRIPT language=JavaScript>alert('对不起，非法操作！');"
			response.write"javascript:window.close();</SCRIPT>"
			response.end
		end if
		set rs=server.createobject("adodb.recordset")
		sql="select * from school_book" 
		rs.open sql,conn,2,3
		rs.addnew
		rs("sid")=sid
		rs("uname")=ReplaceBadChar(Trim(Request.Form("uname")))
		rs("email")=ReplaceBadChar(Trim(Request.Form("email")))
		rs("note")=ReplaceBadChar(Trim(Request.Form("note")))
		rs("stime")=now()
		rs.update
		response.write"<SCRIPT language=JavaScript>alert('留言成功，感谢您的支持');"
		response.write"javascript:window.close();</SCRIPT>"
		response.end
		rs.close
		rs=nothing
		conn.close
		set conn=nothing
	end if
%>
<html>
<HEAD>
<link rel="Shortcut Icon" href="Images/favicon.ico">
<link rel="Bookmark" href="Images/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<TITLE><%= homename %>--给(<%= Trim(Request.QueryString("sname")) %>)留言</TITLE>
<meta name="Keywords" content="<%= webmeta %>">
<meta name="Description" content="<%= webmeta1 %>">
<link href="css/View_school.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
	id=ReplaceBadChar(int(Trim(Request.QueryString("id"))))
	if id="" then
		response.write"<SCRIPT language=JavaScript>alert('对不起，非法操作！');"
		response.write"javascript:window.close();</SCRIPT>"
		response.end
	end if
	set rs=server.createobject("adodb.recordset")
	sql="select * from school where id="&id&"" 
	rs.open sql,conn,1,1
	if rs.bof and rs.eof then
		response.write"<SCRIPT language=JavaScript>alert('对不起，非法操作！');"
		response.write"javascript:window.close();</SCRIPT>"
		response.end
	else
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
    if(document.userinfo.uname.value==""){
		document.userinfo.uname.focus();
    	alert("对不起，请填写您的姓名！");
	return false;
  }
 if(document.userinfo.email.value.length!=0)
  {
    if (document.userinfo.email.value.charAt(0)=="." ||        
         document.userinfo.email.value.charAt(0)=="@"||       
         document.userinfo.email.value.indexOf('@', 0) == -1 || 
         document.userinfo.email.value.indexOf('.', 0) == -1 || 
         document.userinfo.email.value.lastIndexOf("@")==document.userinfo.email.value.length-1 || 
         document.userinfo.email.value.lastIndexOf(".")==document.userinfo.email.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.userinfo.email.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空！");
   document.userinfo.email.focus();
   return false;
	}
   if(document.userinfo.note.value=="") {
	document.userinfo.note.focus();
    alert("对不起，请填写留言内容！");
	return false;
  }
}
//-->
</script>
<form name="userinfo" method="post" action="?action=save" onSubmit="return check()">
	<input name="sid" type="hidden" value="<%= Trim(Request.QueryString("id")) %>">
<table width="52%" height="208" border="0">
  <tr>
    <td height="204" align="center" valign="top">
	<table width="500" height="51" border="0" cellpadding="0" cellspacing="0">
      <tr>
   <td height="38" align="left" valign="middle" background="images/school/jz_021.gif">&nbsp;</td>
      </tr>
    </table>
      <table width="497" border="0" align="right" cellpadding="2" cellspacing="1" bgcolor="#5A9AD6">
        <tr>
          <td width="63" height="20" align="center" bgcolor="#D6F3FF">您的姓名</td>
          <td width="423" height="20" align="left" bgcolor="#FFFFFF"><input name="uname" type="text" size="10"> 
            &nbsp;<font color="#FF0000"><b>*</b></font></td>
        </tr>
        <tr>
          <td height="20" align="center" bgcolor="#D6F3FF">您的邮箱</td>
          <td height="20" align="left" bgcolor="#FFFFFF"><input name="email" type="text" size="38">
            &nbsp;<font color="#FF0000"><b>*</b></font></td>
        </tr>
        <tr>
          <td height="73" align="center" bgcolor="#D6F3FF">留言内容</td>
          <td align="left" valign="middle" bgcolor="#FFFFFF"><textarea name="note" cols="53" rows="5"></textarea>
&nbsp;<font color="#FF0000"><b>*</b></font></td>
        </tr>
        <tr>
          <td height="36" align="center" bgcolor="#FFFFFF" colspan="2"><input type="submit" name="Submit" value="提交">
      &nbsp;
      <input type="reset" name="Submit" value="重置"></td>
        </tr>
      </table>
   </td>
  </tr>
</table>
</form>
<%
	end if
	rs.close
	set rs=nothing
	call closeconn()
%>
</body>
</html>
