<%
'程序名称：千纸鹤网站管理系统
'程序作者：千纸鹤
'作者邮箱：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
elseif session("superadmin")<>"admin" then
response.Write "<script>alert('\n错误提示：您的权限不足！\n\n您不是超级管理员！');this.location.href='index.asp';</script>"
Response.End
end if
%>
<%
dim link
sql="select * from [YC_link] where pass=False order by id DESC"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
link=rs.recordcount%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="img/admin.css" rel="stylesheet" type="text/css">
</head>
<body> <%if request("type")=""then%>
<table width="100%"  border="1" cellpadding="0" cellspacing="0" bordercolor="<%=border%>"  rules=none class=3d>
<tr height=25 class=title><td colspan=5><b>&nbsp;<img src=img/ie.gif border=0 width=15 height=15 align=absMiddle>&nbsp;连接管理 [未通过的有<%=link%>个]</b></td></tr>
  <tr height=25 class=bg>
    <td width="14%"><div align="center">网站logo</div></td>
    <td width="34%"><div align="center">网站介绍</div></td>
    <td width="7%"><div align="center">站长</div></td>
    <td width="9%"><div align="center">状态</div></td>
    <td width="17%"><div align="center">选项</div></td>
  </tr><tr><td class="hr" colspan="5"></td></tr>
<%
sql="select * from [YC_link] 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=10
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 onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#efefef'" class=3d>
    <td height="50"><div align="center"><a href="<%=rs("url")%>" target="_blank">
<%if  rs("type")="logo" then%>
<img src='<%=rs("logo")%>' width='88' height='31' border='0' title="网站名称：<%=rs("webname")%><br>加入时间：<%=rs("time")%>">
<%else%>
<font title='网站名称：<%=rs("webname")%><br>加入时间：<%=rs("date")%>'><%=rs("webname")%></font>
<%end if%></a></div></td>
    <td height="50"><div align="left"><%=rs("content")%></div></td>
    <td height="50"><div align="center"><%=rs("adminname")%></div></td>
    <td height="50"><div align="center"><%if rs("pass")=true then response.Write"已审核" end if 
	                                      if rs("best")=true then response.Write"<br>已推荐" end if%></div></td>
<td height="50"><div align="center"><a href="?action=del&id=<%=rs("id")%>" onclick="mybox('你确定要删除，删除后不能恢复！！');return document.del">删除</a>&nbsp;
      <%if rs("pass")=0 then %>
      <a href="?action=pass&id=<%=rs("id")%>">通过审核</a><%else%>
      <a href="?action=nopass&id=<%=rs("id")%>">取消审核</a>
      <%end if%><br>
      <a href="?type=edit&id=<%=rs("id")%>">修改</a>&nbsp;
      <%if rs("best")=0 then%>
      <a href="?action=best&id=<%=rs("id")%>">设为推荐</a>
      <%else%>
      <a href="?action=nobest&id=<%=rs("id")%>">取消推荐</a>
      <%end if%></div></td>
  </tr><tr><td class="hr" colspan="5"></td></tr>
<%
if i=rs.pagesize then exit do end if
i=i+1
rs.movenext
loop
end if
%>
<tr class=bg><td  height=25 colspan=6>
<table width=100% border=0><tr><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("?page=",<%=mypage%>,<%=pages%>);
</script>
</td></tr></table>
</td></tr>
</form></table>
<%elseif request("type")="edit"then
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from YC_link where id="&request("id")
rs1.open sql1,conn,1,3
if request.Form("submitedit")<>""then
rs1("class")=request.Form("class")
rs1("webname")=request.Form("webname")
rs1("adminname")=request.Form("adminname")
rs1("url")=request.Form("url")
rs1("logo")=request.Form("logo")
rs1("content")=request.Form("content")
rs1("best")=request.Form("best")
rs1("pass")=request.Form("pass")
rs1.update
response.Write"<script>location.href='admin_link.asp';</script>"
end if
%><br>
<form method="post" name="form" id="form" onsubmit="return chk();">
  <table width="450"  border="1" cellpadding="0" cellspacing="0" bordercolor="<%=border%>"  rules=none class=3d align=center>
    <tr class=title>
      <td width="25%" height="25" colspan=2>&nbsp;※&nbsp;修改连接</td>
    </tr>
   <tr>
      <td width="25%" height="25">&nbsp;显示形式：</td>
      <td width="75%" height="25"><input name="class" type="radio" value="logo" <%if rs1("class")="logo" then%>checked<%end if%>>
      logo链接
        <input type="radio" name="class" value="text" <%if rs1("class")="text" then%>checked<%end if%>>
      文字链接</td>
    </tr>
    <tr>
      <td height="30">&nbsp;网站名称：</td>
      <td height="30"><input name="webname" type="text" id="webname" value="<%=rs1("webname")%>" class=yecao></td>
    </tr>
    <tr>
      <td height="30">&nbsp;站长姓名：</td>
      <td height="30"><input name="adminname" type="text" id="adminname" value="<%=rs1("adminname")%>" class=yecao></td>
    </tr>
    <tr>
      <td height="30">&nbsp;网站地址：</td>
      <td height="30"><input name="url" type="text" id="url" value="<%=rs1("url")%>" class=yecao></td>
    </tr>
    <tr>
      <td height="30">&nbsp;logo地址：</td>
      <td height="30"><input name="logo" type="text" id="logo" value="<%=rs1("logo")%>" class=yecao></td>
    </tr>
    <tr>
      <td>&nbsp;网站介绍：</td>
      <td><textarea name="content" cols="50" rows="5" id="content" class=yecao><%=rs1("content")%></textarea></td>
    </tr>
    <tr>
      <td height="30">&nbsp;是否通过：</td>
      <td height="30"><input name="pass" type="radio" value="true" <%if rs1("pass")=true then%>checked<%end if%>>
      是
        <input type="radio" name="pass" value="false" <%if rs1("pass")=false then%>checked<%end if%>> 
      否</td>
    </tr>
    <tr>
      <td height="30">&nbsp;是否推荐：</td>
      <td height="30"><input name="best" type="radio" value="true" <%if rs1("best")=true then%>checked<%end if%>>
      是
        <input type="radio" name="best" value="false" <%if rs1("best")=false then%>checked<%end if%>>
      否</td>
    </tr><tr><td class="hr" colspan="2"></td></tr>
    <tr class=bg>
      <td height="30" colspan="2"><div align="center">
          <input name="Submitedit" type="submit" id="Submitedit" value="提交" class="adminbutton">&nbsp;<input type="reset" name="Submit" value="重置" class="adminbutton" >
      </div></td>
    </tr>
  </table>
</form>
<%
rs1.close
set rs1=nothing
%>
<br>
</body>
</html>
<%
end if
action=request("action")
select case action
case "del":
call del()
case "best":
call best()
case "nobest":
call nobest()
case "pass":
call pass()
case "nopass":
call nopass()
end select

sub del()
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from [YC_link] where id="&request("id")
rs1.open sql1,conn,1,3
rs1.delete
response.Write"<script>location.href='admin_link.asp';</script>"
rs1.close
set rs1=nothing
end sub

sub best()
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from [YC_link] where id="&request("id")
rs1.open sql1,conn,1,3
rs1("best")=1
rs1.update
response.Write"<script>location.href='admin_link.asp';</script>"
rs1.close
set rs1=nothing
end sub

sub nobest()
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from [YC_link] where id="&request("id")
rs1.open sql1,conn,1,3
rs1("best")=0
rs1.update
response.Write"<script>location.href='admin_link.asp';</script>"
rs1.close
set rs1=nothing
end sub

sub pass()
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from [YC_link] where id="&request("id")
rs1.open sql1,conn,1,3
rs1("pass")=1
rs1.update
response.Write"<script>location.href='admin_link.asp';</script>"
rs1.close
set rs1=nothing
end sub

sub nopass()
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from [YC_link] where id="&request("id")
rs1.open sql1,conn,1,3
rs1("pass")=0
rs1.update
response.Write"<script>location.href='admin_link.asp';</script>"
rs1.close
set rs1=nothing
end sub%>
<%
rs.close
set rs=nothing
%>
