<%
'程序名称：千纸鹤网站管理系统
'程序作者：千纸鹤
'作者邮箱：qzhxxw@sina.com
'作者 Q Q：138999501
'作者电话：0000000000
'官方主页：http://www.qqzzhh.com/
'官方论坛：http://www.qqzzhh.com/bbs
%> 
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/set.asp"-->
<!--#include file="inc/dll.asp"-->
<%call hacker()
if session("superlogin")<>yecao then
response.Write "<script>alert('您还没有登陆！');this.location.href='index.asp';</script>"
Response.End
end if
if session("superadmin")<>"admin" then
response.Write "<script>alert('您不是超级管理员！您的权限不足！');this.location.href='index.asp';</script>"
Response.End
end if%>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="STYLESHEET" type="text/css" href="img/admin.css">
<script src=img/adminjs.js></script></head>
<body>
<%
call titlecolor()
if request.form("edit")<>"" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from YC_gg where id="&request("id")
rs.open sql,conn,1,3
rs("gg")=request.Form("gg")
rs("color")=request.Form("color")
rs("date")=date()
rs.update
rs.close
response.Redirect"admin_gg.asp"
set rs=nothing
elseif  request.form("new")<>"" then
set rs=server.CreateObject("adodb.recordset")
rs.open "YC_gg",conn,1,3
rs.addnew
rs("gg")=request.Form("gg")
rs("color")=request.Form("color")
rs.update
rs.close
set rs=nothing
response.write"<script>location.href='admin_gg.asp';</script>"
elseif request("action")=""then
dim gg
sql="select * from YC_gg order by id DESC"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
gg=rs.recordcount%>
<table width="100%" align=center border="0" cellpadding="0" cellspacing="0" bordercolor="<%=border%>" rules=none class=3d>
<tr><td height="22" colspan="6" class=title><b>&nbsp;<img src=img/ie.gif border=0 width=15 height=15 align=absMiddle>&nbsp;公告管理 [当前共有<%=gg%>条公告]</b></td></tr>
<tr class=bg height="25">
<form  method="post" name="form" id="form" action="del.asp" onsubmit="return downdel();">
<td width="5%"  align=center>选定</td>
<td width="80%" align=center>公告</td>
<td width="5%" align=center>操作</td></tr><tr><td class="hr" colspan="6"></td></tr>
<%
sql="select * from [YC_gg] order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.bof and not rs.eof then
rs.pagesize=cint(adminpage)
i=1
mypage=request("page")
if mypage="" then
mypage=1
else
mypage=cint(mypage)
end if
pages=rs.pagecount
rs.absolutepage=mypage
do while not rs.eof%>
<tr height=25 class=bg onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#efefef'">
<td align=center>
<input name='SoftID' type='checkbox' onclick="unselectall()" id="SoftID" value='<%=rs("id")%>'></td>
<td><font color=<%=rs("color")%>><%if len(rs("gg"))>120 then response.Write left(rs("gg"),120)&"..." else response.Write rs("gg") end if%></font>[<%=rs("date")%>]</td>
<td>&nbsp;<a href="?action=edit&id=<%=rs("id")%>">编辑</a>&nbsp;</td></tr><tr><td class="hr" colspan="6"></td></tr>
<%
if i=rs.pagesize then exit do end if
i=i+1
rs.movenext
loop
end if
if rs.eof and rs.bof then
response.write"<tr><td colspan=6 height=100 align=center>暂时没有公告！</td></tr>"
else%>
<tr class=bg><td  height=25 colspan=6>
<table width=100% border=0><tr><td width=200>
&nbsp;<input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
<input name="submit" type="submit" onClick="document.form.Action.value='Del'" value="删 除" class=adminbutton>
<input name="Action" type="hidden" id="Action" value="Del">
<input name="tab" type="hidden" id="tab" value="YC_gg">
<input name="url" type="hidden" id="url" value="admin_gg.asp">
</td><td>
&emsp;&emsp;共有公告<font color=red><%=rs.recordcount%></font>条，每页<font color=red><%=rs.pagesize%></font>条，分<font color=red><%=mypage%></font><%=rs.pagecount%>页&emsp;&emsp;&emsp;
<script language="javascript">
function showPageLink(sUrl,iPage,iCount){
var i;
i=Math.max(1,iPage-1);
document.write("<a href=\""+sUrl+"1\"><FONT face=Webdings>9</FONT></a> ");
document.write("<a href=\""+sUrl+i+"\"><FONT face=Webdings>7</FONT></a> <b>");
for(i=Math.max(1,iPage-5);i<iPage;i++){
document.write("<a href=\""+sUrl+i+"\">"+i+"</a> ");}
document.write("<font color='#ff3333'>"+iPage+"</font> ");
for(i=iPage+1;i<=Math.min(iCount,iPage+5);i++){
document.write("<a href=\""+sUrl+i+"\">"+i+"</a> ");}
i=Math.min(iCount,iPage+1);
document.write("</b><a href=\""+sUrl+i+"\"><FONT face=Webdings>8</FONT></a> ");
document.write("<a href=\""+sUrl+iCount+"\"><FONT face=Webdings>:</FONT></a> ");}
showPageLink("?action=list&page=",<%=mypage%>,<%=pages%>);
</script>
</td></tr>
</table>
</td></tr>
</form>
<%end if%>
<%elseif request("action")="new"then%>
<script language="javascript">
function chk(){
if(document.form.title.value==""){
alert("公告不能为空");
document.form.title.focus();
return false;}
return true;}
</Script>
<form method="post" name="form" id="form" onsubmit="return chk();">
<table width="95%" align=center border="0" cellpadding="0" cellspacing="0" rules=none class=3d>
<tr class="title"  height="22"><td><b>&nbsp;<img src=img/ie.gif border=0 width=15 height=15 align=absMiddle>&nbsp;发布公告</b></td></tr>	
<tr class=bg height="25"><td>&nbsp;公告内容：<input name="gg" type="text" id="gg"  class=yecao style="width:400px">
</td></tr>
<tr class=bg height="25"><td>&nbsp;公告颜色：<input name="color" type="text" onfocus="colordialog()" class=yecao 
value="#000000" style="width:120px"></td></tr>
<tr><td class="hr"></td></tr>
<tr height="30" class=foot><td  align="center">
<input name="new" type="submit" class="adminbutton" id="new" value="发 布">&nbsp;<input name="Submit2" type="reset" class="adminbutton" value="清 空" ></td></tr>
</table> 
</form>
<%elseif request("action")="edit"then
set rs=server.CreateObject("adodb.recordset")
sql="select * from YC_gg where id="&request.QueryString("id")
rs.open sql,conn,1,3%>
<script language="javascript">
function chk(){
if(document.form.gg.value==""){
alert("公告不能为空");
document.form.gg.focus();
return false;}
return true;}
</Script>
<form method="post" name="form" id="form" onsubmit="return chk();">
<table width="95%" align=center border="0" cellpadding="0" cellspacing="0" bordercolor="<%=border%>" rules=none class=3d>
<tr><td height="22"  class=title><b>&nbsp;<img src=img/ie.gif border=0 width=15 height=15 align=absMiddle>&nbsp;修改公告</b></td></tr>
<tr class=bg height=25><td>&nbsp;公告内容：<input name="gg" type="text" id="gg" value="<%=rs("gg")%>"  class=yecao style="width:400px"></td></tr>
<tr class=bg height="25"><td>&nbsp;公告颜色：<input name="color" type="text" onfocus="colordialog()" class=yecao 
value="<%=rs("color")%>" style="width:120px"></td></tr>
<tr><td class="hr"></td></tr>
<tr height="30" class=foot><td align="center">
<input name="edit" type="submit" class="adminbutton" id="edit" value="修 改">&nbsp;<input name="Submit2" type="reset" class="adminbutton" value="清 空"></td></tr></table></form>
<%rs.close
set rs=nothing
end if
call closedata()%>

