<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% if session("admid")="" or Session("class")<>"1" then response.redirect"login.asp"%>
<!--#include file="Conn.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
.style1 {color: #999999}
-->
</style>
</head>

<body>
<%  Dim Page
   Page="pic.asp?page="&request("page")
      Select case request.QueryString("action")
	         Case "del"
			    Set Rs=Conn.Execute("Select pic from pic where id in ("&Request.Form("delid")&")")
				    If Not Rs.eof then
					   Do while not rs.eof
					      Set FSO=Server.CreateObject("Scripting.FileSystemObject")
						      FSO.Deletefile "../"&Rs(0),true
						  Set FSO=Nothing
						Rs.MoveNext
						LOop
					End IF
				Set Rs=Nothing
				Conn.Execute("delete * from pic where id in ("&Request.Form("delid")&")")
				Response.Redirect(page)
			Case "xy"
			   Conn.execute("update pic Set sortid=2 where id="&cint(Request.QueryString("id")))
			   Response.Redirect(page)	
			case "jc"
			   Conn.execute("update pic Set sortid=1 where id="&cint(Request.QueryString("id")))
			   Response.Redirect(page)
			Case "checked"
			   Conn.execute("update pic Set [check]=0 where id="&cint(Request.QueryString("id")))
			   Response.Redirect(page)	
			Case "check"
			   Conn.execute("update pic Set [check]=1 where id="&cint(Request.QueryString("id")))
               Response.Redirect(page)	
			case "addpic"
			   Conn.execute("Insert into pic(pic,sortid,[user],Content) values('"&Replace(Request.Form("pic"),"../","")&"',"&Request.form("sortid")&",'admin','"&left(Server.HTMLEncode(Request.form("Content")),150)&"')")
			   Response.Redirect(page)
			Case "edit"
			   If Request.QueryString("number")<>"" Then
			        Conn.execute("update pic Set [number]="&request.QueryString("number")&" where id="&cint(Request.QueryString("id")))
					Response.Redirect(page)	
				End if	
		    Case "picedit"
			       Conn.Execute("Update pic set pic='"&Replace(Request.Form("pic"),"../","")&"',Content='"&Request.Form("Content")&"',Sortid="&Request.form("sortid")&" where ID="&Request.QueryString("id")&"")		
			       Response.Redirect(page)	
			Case "add"         	     
%>
<table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#006d63" style="border-collapse: collapse">
  <tr bgcolor="#FFFFFF">
    <td height="25" colspan="2">+添加一张图片</td>
  </tr>
  <form action="?action=addpic&page=<%=Request("page")%>" method="post" name="myform">
  <tr bgcolor="#FFFFFF">
    <td width="101" height="25">图片类别</td>
    <td width="376" height="25"><select name="sortid" id="sortid">
      <option value="1" selected>校园环境</option>
      <option value="2">精彩连连看</option>
    </select></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">上传图片</td>
    <td height="25"><input name="pic" type="text" id="pic" >
      <input type="button" name="goimg2 " value="上传图片" onClick="window.open('upload_flash.asp?formname=myform&editname=pic&uppath=../upload&filelx=jpg','','status=no,scrollbars=no,top=220,left=220,width=420,height=165')"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">说明(<span class="style1">150字以内</span>)</td>
    <td height="25"><textarea name="Content" cols="50" rows="6" id="Content"></textarea></td>
  </tr>
  <tr align="center" bgcolor="#FFFFFF">
    <td height="25" colspan="2"><input type="submit" name="Submit" value="提交"></td>
  </tr>
  </form>
</table>
<%
 Case "editpic"
   Set Rst=Conn.execute("Select * from pic where ID="&Request.QueryString("id")&"")
       If Not Rst.Eof then
%>
<table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#006d63" style="border-collapse: collapse">
  <tr bgcolor="#FFFFFF">
    <td height="25" colspan="2">+添加一张图片</td>
  </tr>
  <form action="?action=picedit&page=<%=Request("page")%>&id=<%=Rst(0)%>" method="post" name="myform">
  <tr bgcolor="#FFFFFF">
    <td width="101" height="25">图片类别</td>
    <td width="376" height="25"><select name="sortid" id="sortid">
      <option value="1"  <%If Rst("Sortid")="1" Then Response.Write("Selected")%>>校园环境</option>
      <option value="2" <%If Rst("Sortid")="2" Then Response.Write("Selected")%>>精彩连连看</option>
    </select></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">上传图片</td>
    <td height="25"><input name="pic" type="text" id="pic" value="<%=Rst("pic")%>">
      <input type="button" name="goimg2 " value="上传图片" onClick="window.open('upload_flash.asp?formname=myform&editname=pic&uppath=../upload&filelx=jpg','','status=no,scrollbars=no,top=220,left=220,width=420,height=165')"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">说明(<span class="style1">150字以内</span>)</td>
    <td height="25"><textarea name="Content" cols="50" rows="6" id="Content"><%=Rst("Content")%></textarea></td>
  </tr>
  <tr align="center" bgcolor="#FFFFFF">
    <td height="25" colspan="2"><input type="submit" name="Submit" value="提交"></td>
  </tr>
  </form>
</table>
<%
  End If
  Set Rst=Nothing
  end Select
 Conn.Close
 set Conn=Nothing 
%>
</body>
</html>
