<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/char.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="uploadfile_inc.asp"-->
<!--#include file="function.asp"-->
<!--#include file="../inc/sql.asp"-->
<%
	End If
	if Trim(Request.QueryString("action"))="edit" then
		
		nn=""
		formsize = request.totalbytes
		formdata = request.binaryread(formsize)
		bcrlf = chrb(13) & chrb(10)
		divider = leftb(formdata, instrb(formdata, bcrlf) - 1)
		path = Server.MapPath("..\upimages\school")
		filename = SaveFile("attachment",path,500)
		if filename = "" then error ="图片大小不要超过500K！返回重新输入"
		if error <> "" then
			response.write "<script language=javascript>alert('"&error&"');location.href='javascript:history.back()';</script>"
			response.end
		end if
		Set rs = Server.CreateObject("ADODB.Recordset")
		sql="select * from school where sname='"&ReplaceBadChar(Request.Cookies("admin_school_name"))&"'"
		rs.open sql,conn,2,3
		if rs.eof then
			response.write"<SCRIPT language=JavaScript>alert('非法操作，请重新登陆');"
			response.write"this.location.href='login.asp';</SCRIPT>"
			response.end
		else
			rs("school_name")=GetFormVal("school_name")
			rs("address")=GetFormVal("address")
			rs("code")=GetFormVal("code")
			rs("lxperson")=GetFormVal("lxperson")
			rs("phone")=GetFormVal("phone")
			rs("open1")=GetFormVal("open1")
			rs("fax")=GetFormVal("fax")
			rs("open2")=GetFormVal("open2")
			rs("weburl")=GetFormVal("weburl")
			if nn&"a"="a" then
				if GetFormVal("logo")<>"" then
					rs("logo")=GetFormVal("logo")
				end if
			else
				rs("logo")=nn
			end if
			rs("aboutschool")=GetFormVal("aboutschool")
			rs("email")=GetFormVal("email")
			rs.update
			response.write"<SCRIPT language=JavaScript>alert('您的操作已完成，现在为您返回');"
			response.write"this.location.href='main.asp';</SCRIPT>"
			response.end
		end if
		rs.close
		set rs=nothing
		conn.close
		set conn=nothing
	end if
%>
<HTML>
<head>
<meta http-equiv=Content-Language content=zh-cn>
<meta http-equiv=Content-Type content=text/html; charset=gb2312>
<link href="images/1.css" rel="stylesheet" type="text/css">
<link href="images/2.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkuserinfo()
{
   if(checkspace(document.userinfo.school_name.value)) {
	document.userinfo.school_name.focus();
    alert("对不起，请填写学校名称！");
	return false;
  }
   if(checkspace(document.userinfo.address.value)) {
	document.userinfo.address.focus();
    alert("对不起，请填写学校地址！");
	return false;
  }
   if(checkspace(document.userinfo.code.value)) {
	document.userinfo.code.focus();
    alert("对不起，请填写邮政编码！");
	return false;
  }
   if(checkspace(document.userinfo.lxperson.value)) {
	document.userinfo.lxperson.focus();
    alert("对不起，请填写联系人！");
	return false;
  }
   if(checkspace(document.userinfo.phone.value)) {
	document.userinfo.phone.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;
	}
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//-->
</script>
</head>
<body topmargin="0">
<%
	set rs=server.createobject("adodb.recordset")
	sql="select * from school where sname='"&ReplaceBadChar(Request.Cookies("admin_school_name"))&"'"
	rs.open sql,conn,1,1
	if rs.eof then
		response.write"<SCRIPT language=JavaScript>alert('非法操作！');"
		response.write"this.location.href='login.asp';</SCRIPT>"
		response.end
	else
%>
<form action="?action=edit" method="post" name="userinfo" onSubmit="return checkuserinfo()" ENCTYPE="multipart/form-data">
<input name="logo" type="hidden" value="<%= rs("logo") %>">
<table width="550"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="images/m_11.gif" width="550" height="9"></td>
  </tr>
  <tr>
    <td background="images/m_13.gif"><div align="left">
      <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td><div align="left"><img src="images/jianli-8.gif" width="136" height="33">
          </div>
            <TABLE width="100%" border=0 cellPadding=0 cellSpacing=1 bgColor=#83b629 align="center">
              <TBODY>
                <TR>
                  <TD height="358" vAlign=top bgColor=#ffffff><TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
                    <TBODY>
                      <TR>
                        <TD vAlign=top width="100%" height="358"><TABLE height=24 cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
                            <TBODY>
                              <TR>
                                <TD bgColor=#83b629 height=21><FONT style="FONT-SIZE: 13px" face=Verdana color=#ffffff><STRONG>学校资料</STRONG></FONT></TD>
                              </TR>
                              <TR>
                                <TD bgColor=#e2e2e2 height=2></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                            <DIV align=center><FONT size=2><BR>
                                  <TABLE id=show cellSpacing=0 cellPadding=3align=center border=0>
                                    <TBODY>
                                      <TR>
                                        <td><table width=100%>
                                            <tr>
                                              <TD align=right width=68><FONT color=#ff4e00>*</FONT>学校名称：</TD>
                                              <TD width=301><input name="school_name" id="school_name" type="text" maxlength="70" size="40" value="<%= rs("school_name") %>"/></TD>
                                              <TD width=146>&nbsp;</TD>
                                            </tr>
                                          </table>
                                            <table width=100%>
                                              <tr>
                                                <TD align=right width=68>展示图片：</TD>
                                                <TD width=451><INPUT NAME="attachment" TYPE="FILE" id="attachment" SIZE="20"></TD>
                                              </tr>
                                            </table>
                                          <table width=100%>
                                              <tr>
                                                <TD align=right valign=top width=67><FONT color=#ff4e00>*</FONT>学校简介：</TD>
                                                <TD width=452><textarea name="aboutschool" rows="8" style="width: 400px;font-size: 12px;display:none;" cols="20"><%= rs("aboutschool") %></textarea><iframe ID="Editor" name="Editor" src="../HtmlEditor/index.html?ID=aboutschool" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="no" style="height:130px;width:450px"></iframe></TD>
                                              </tr>
                                          </table>
                                          <table width=100%>
                                              <tr>
                                                <TD align=right width=68><FONT color=#ff4e00>*</FONT>通讯地址：</TD>
                                                <TD width=405><input name="address" id="address" type="text" maxlength="80" size="55" value="<%= rs("address") %>"/></TD>
                                                <TD width=42>&nbsp;</TD>
                                              </tr>
                                          </table>
                                          <table width=100%>
                                              <tr>
                                                <TD width=67 height="20" align=right><FONT color=#ff4e00>*</FONT>邮政编码：</TD>
                                                <TD width=227><input name="code" id="code" type="text" maxlength="6" size="15" require="false" value="<%= rs("code") %>"/>
                                                </TD>
                                                <TD width=221>&nbsp;</TD>
                                              </tr>
                                          </table>
                                          <table width=100%>
                                              <tr>
                                                <TD align=right width=67><FONT color=#ff4e00>*</FONT>联系人：</TD>
                                                <TD width=452><input name="lxperson" id="lxperson" type="text" maxlength="50" size="15" require="false" value="<%= rs("lxperson") %>"/>
                                                </TD>
                                              </tr>
                                          </table>
                                          <table width=100%>
                                              <tr>
                                                <TD align=right width=68><FONT color=#ff4e00>*</FONT>联系电话：</TD>
                                                <TD width=307><input name="phone" id="phone" type="text" maxlength="50" size="23" require="false" value="<%= rs("phone") %>"/>
                                                  &nbsp;<span style="color:#404040;">
                                                    <input id="open1" type="checkbox" name="open1" value="1" <% If rs("open1")=0 Then Response.Write("checked")%>/>
                                                    <label for="janCorporationTelConceal">隐藏</label>
                                                </span> </TD>
                                                <TD width=140>&nbsp;</TD>
                                              </tr>
                                          </table>
                                          <table width=100%>
                                              <tr>
                                                <TD align=right width=68>传真号码：</TD>
                                                <TD width=451><input name="fax" id="fax" type="text" maxlength="50" size="23" require="false" value="<%= rs("fax") %>"/>
                                                  &nbsp;<span style="color:#404040;">
                                                    <input id="open2" type="checkbox" name="open2" value="1" <% If rs("open2")=0 Then Response.Write("checked")%>/>
                                                    <label for="janCorporationFaxConceal">隐藏</label>
                                                </span></TD>
                                              </tr>
                                          </table>
                                          <table width=100%>
                                              <tr>
                                                <TD align=right width=68>学校主页：</TD>
                                                <TD width=451><input name="weburl" id="weburl" type="text" maxlength="50" size="30" require="false" value="<%= rs("weburl") %>"/>
                                                &nbsp; </TD>
                                              </tr>
                                          </table>
<table width=100%>
                                              <tr>
                                                <TD align=right width=68><FONT color=#ff4e00>*</FONT>电子邮局：</TD>
                                                <TD width=451><input name="email" id="email" type="text" maxlength="50" size="30" require="false" value="<%= rs("email") %>"/>
                                                &nbsp; </TD>
                                              </tr>
                                          </table>
										  <table width=100%>
                                              <tr>
                                                <TD align=center><input name="Submit" type="submit" class="INPUT_index" id="Submit" style="height:23px;width:70px;" value="  注    册  " />
                &nbsp;
                &nbsp;
       <input name="Reset" type="button" class="INPUT_index" id="Reset" style="FONT-SIZE: 12px; FONT-FAMILY: 宋体; HEIGHT: 23px;width:70px;" value="  取   消  " onClick="javascript:window.location.href='main.asp';"/></TD>
                                              </tr>
                                          </table>
									    </td>
                                      </tr>
                                    </TBODY>
                                  </TABLE>
                            </FONT></DIV></TD>
                      </TR>
                    </TBODY>
                  </TABLE></TD>
                </TR>
              </TBODY>
            </TABLE>
            </td>
        </tr>
      </table>
    </div></td>
  </tr>
  <tr>
    <td background="images/m_13.gif"></td>
  </tr>
  <tr>
    <td><img src="images/m_12.gif" width="550" height="9"></td>
  </tr>
</table>
</form>
<%
	End If
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
%>
</body>
</html>