📄 admin_link.asp
字号:
<%
'==================================
'=文 件 名:admin_link.asp
'=适用版本:游戏天府WAP网站管理系统(CMS)V1.1
'=官方版权:http://www.gotf.cn
'=文件功能:网站链接系统管理
'=文件作者:游戏天府
'=发行时间:2007-02-01
'==================================
%>
<!--#include file="wapls_admin_conn.asp"-->
<!--#include file="wapls_admin_top.asp"-->
<%
if session("wapls_adminlogin")<>wapls_sessionvar then
errmsg="您没有登陆或不是管理员。请登陆。"
response.write "<script>window.alert('"&errmsg&"');window.location='admin_login.asp';</script>"
response.End
end if
dim page,flcatname,cat_id,link_name,link_url,link_id,passed
if request.querystring("page")<>"" then
page=checksql("链接分页",request.querystring("page"),0,8)
end if
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<tr align="center">
<td class="td_title" width="25%"><a href="?action=catlist"><font color="#ffffff">链接分类管理</font></a></td>
<td class="td_title" width="25%"><a href="?action=list"><font color="#ffffff">链接管理</font></a></td>
<td class="td_title" width="25%"><a href="?action=addlink"><font color="#ffffff">添加链接</font></a></td>
<%dim passing
sql="select link_id from wapls_link where passed=1"
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
passing=rs2.recordcount
rs2.close
set rs2=nothing%>
<td class="td_title" width="33%" ><a href="?action=checklist"><font color="#ffffff">链接审核(待审核数:<%=passing%>)</font></a></td>
</tr>
</table>
<br>
<%
'==================================
'=功 能:主调代码,相应功能皆有说明
'==================================
Select case request.QueryString("action")
case "catlist" '链接分类列表
call catlist()
case "addcat" '添加分类
call addcat()
case "editcat" '编辑分类
call editcat()
case "delcat" '删除分类
call delcat()
case "list" '链接列表
call list()
case "addlink" '后台添加链接
call addlink()
case "editlink" '编辑已有链接
call editlink()
case "dellink" '删除已有链接
call dellink()
case "checklist" '待审核链接列表
call checklist()
case "checkpass" '待审核链接通过审核
call checkpass()
case "checkdel" '待审核链接未通过审核,删除
call checkdel()
case else
call list()
End Select
'==================================
'=过 程 名:list()
'=功 能:链接列表
'==================================
sub list()
sql="select * from wapls_link where passed=0 order by link_id desc"
if request.querystring("cat_id")<>"" then
catid=checksql("链接分类ID",request.querystring("cat_id"),0,8)
sql="select * from wapls_link where cat_id="&catid&" and passed=0 order by link_id desc"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<form name="form3" method="post" action="">
<tr class="tablebody">
<td align="right"><a href="?action=link">显示所有链接</a> |
<%
sql="select * from wapls_link_cat"
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof
%>
<a href="?action=link&cat_id=<%=rs2("cat_id")%>"><%=rs2("cat_name")%></a> |
<%
rs2.movenext
loop
if rs2.bof and rs2.eof then
response.write"<span class='disable_font'>当前没有分类</span>"
end if
rs2.close
set rs2=nothing
%>
</select>
</td>
</tr>
</form>
</table>
<br>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<tr class="tablebody">
<td colspan="5" class="td_title">链接管理</td>
</tr>
<tr align="center" class="tablebody">
<td width="8%">编号</td>
<td width="*">链 接 名 称</td>
<td width="20%">链 接 分 类</td>
<td width="100">链 接 图 片</td>
<td width="20%">操 作</td>
</tr>
<%
if not rs.eof then
rs.movefirst
perpage=cint(perpage)
rs.pagesize=perpage
if trim(request("page"))<>"" then
currentpage=cint(request.querystring("page"))
if currentpage>rs.pagecount then
currentpage=rs.pagecount
end if
else
currentpage=1
end if
totallink=rs.recordcount
if currentpage<>1 then
if (currentpage-1)*perpage<totallink then
rs.move(currentpage-1)*perpage
end if
end if
if (totallink mod perpage)=0 then
totalpages=totallink\perpage
else
totalpages=totallink\perpage+1
end if
i=0
do while not rs.eof and i<perpage
sql="select cat_name,isimage from wapls_link_cat where cat_id="&rs("cat_id")
set rs2=conn.execute(sql)
%>
<tr class="tablebody">
<td align="center"><%=rs("link_id")%></td>
<td><a href="<%=rs("link_url")%>" title="网站名称:<%=rs("link_name")%> 网站地址:<%=rs("link_url")%> 网站简介:<%=rs("link_content")%> 加入时间:<%=rs("link_date")%>" target="_blank"><%=rs("link_name")%></a></td>
<td align="center"><%=rs2("cat_name")%><%if rs2("isimage")=0 then%><span class="disable_font">[文]</span><%end if%></td>
<td align="center">
<%
if rs("link_logo")<>"" then
if left(rs("link_logo"),7)="http://" then
response.write "<img src='"&rs("link_logo")&"'>"
else
response.write "<img src='../"&rs("link_logo")&"'>"
end if
else
response.write "<span class='disable_font'>无Logo</span>"
end if
%>
</td>
<td align="center"><button onClick="window.location='?action=editlink&id=<%=rs("link_id")%>&page=<%=currentpage%>'">编辑</button> <button onClick="window.location='?action=dellink&id=<%=rs("link_id")%>&page=<%=currentpage%>'">删除</button></td>
</tr>
<%
i=i+1
rs.movenext
loop
else
if rs.eof and rs.bof then
%>
<tr class="tablebody">
<td colspan="5" align="center" height="70" class="disable_font">当前还没有链接!</td>
</tr>
<%
rs2.close
set rs2=nothing
rs.close
set rs=nothing
end if
end if
%>
</table>
<%if totallink>perpage then%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<form name="form" method="post" action="">
<tr class="tablebody">
<td align="center"><%showpage totallink,perpage,"admin_link.asp?action=list&"%></td>
</tr>
</form>
</table>
<%
end if
end sub
'==================================
'=过 程 名:catlist()
'=功 能:链接分类列表
'==================================
sub catlist()
sql="select * from wapls_link_cat"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<tr class="tablebody">
<td colspan="3" class="td_title">链接分类管理 [<a href="?action=addcat"><font color="#ffff00">新添分类</font></a>]</td>
</tr>
<tr class="tablebody" align="center">
<td width="10%">编号</td>
<td width="70%">分类名称</td>
<td width="20%">操作</td>
</tr>
<%
do while not rs.eof
%>
<tr class="tablebody">
<td align="center"><%=rs("cat_id")%></td>
<td><%=rs("cat_name")%> <%if rs("isimage")=0 then%>[文本链接] <%else%><span class="current_font">[图片链接]</span> <%end if%></td>
<td align="center"><button onClick="window.location
='?action=editcat&id=<%=rs("cat_id")%>'">编辑</button> <button onClick="window.location='?action=delcat&id=<%=rs("cat_id")%>'">删除</button></td>
</tr>
<%
rs.movenext
loop
if rs.bof and rs.eof then
%>
<tr align="center" class="tablebody">
<td colspan="3" height="50" height="70" class="disable_font">当前没有链接分类!<a href="?action=addcat"><span class="current_font">新添分类</span></a></td>
</tr>
<%
rs.close
set rs=nothing
end if
%>
</table>
<%end sub
'==================================
'=过 程 名:addcat()
'=功 能:新添链接分类
'==================================
sub addcat()
if request.form("addcat")="true" then
flcatname=checksql("链接分类",request.form("cat_name"),1,10)
sql="select * from wapls_link_cat"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("cat_name")=flcatname
if request.form("isimage")="" then
rs("isimage")=1
elseif request.form("isimage")="0" then
rs("isimage")=0
else
rs("isimage")=1
end if
rs.update
rs.close
set rs=nothing
response.redirect "?action=catlist"
end if
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<form name="form1" method="post" action="">
<tr class="tablebody">
<td class="td_title">新增链接分类</td>
</tr>
<tr class="tablebody">
<td align="center" style="line-height:150%;height:50px;">分类名称:<input type="text" name="cat_name" size="20" maxlength="10"> <input type="checkbox" name="isimage" value="0"> 文本链接<br><span class="disable_font">[注:分类名称最多10字符]</span></td>
</tr>
<tr class="tablebody">
<td height="30" align="center">
<input type="submit" name="Submit" value="确定新增">
<input type="reset" name="Reset" value="清空重填">
<input type="hidden" name="addcat" value="true">
</td>
</tr>
</form>
</table>
<%
end sub
'==================================
'=过 程 名:editcat()
'=功 能:编辑链接分类
'==================================
sub editcat()
if request.form("editcat")="true" then
cat_id=checksql("链接分类ID",request.Form("id"),0,8)
flcatname=checksql("链接分类",request.form("cat_name"),1,10)
sql="select * from wapls_link_cat where cat_id="&cat_id
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs("cat_name")=flcatname
if request.form("isimage")="" then
rs("isimage")=1
elseif request.form("isimage")="0" then
rs("isimage")=0
else
rs("isimage")=1
end if
rs.update
rs.close
set rs=nothing
response.redirect "?action=catlist"
end if
cat_id=checksql("链接分类ID",request.querystring("id"),0,8)
sql="select * from wapls_link_cat where cat_id="&cat_id
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<form name="form1" method="post" action="">
<tr class="tablebody">
<td class="td_title">修改链接分类</td>
</tr>
<tr class="tablebody">
<td align="center" style="line-height:150%;height:50px;">分类名称:<input type="text" name="cat_name" size="20" value="<%=rs("cat_name")%>" maxlength="10"> <input type="checkbox" name="isimage" value="0" <%if rs("isimage")=0 then response.write "checked" end if%>> 文本链接<br><span class="disable_font">[注:分类名称最多10字符]</span></td>
</tr>
<tr class="tablebody">
<td height="30" align="center">
<input type="submit" name="Submit" value="确定修改">
<input type="reset" name="Reset" value="清空重填">
<input type="hidden" name="id" value="<%=rs("cat_id")%>">
<input type="hidden" name="editcat" value="true">
</td>
</tr>
</form>
</table>
<%
rs.close
set rs=nothing
end sub
'==================================
'=过 程 名:delcat()
'=功 能:删除链接分类
'==================================
sub delcat()
if request.form("delcat")="true" then
cat_id=checksql("链接分类ID",request.Form("id"),0,8)
dim datainthiscat
datainthiscat=conn.Execute("select count(*) from wapls_link where cat_id="&cat_id)(0)
if datainthiscat<>0 then
response.Redirect("../showerr.asp?errmsg=<br><li>此分类下有"&datainthiscat&"条数据,不能删除此分类!如真要删除此分类,请先转移此分类下的数据,再进行删除分类操作!</li>")
response.End
end if
sql="select * from wapls_link_cat where cat_id="&cat_id
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.delete
rs.close
set rs=nothing
response.redirect "?action=catlist"
end if
cat_id=checksql("链接分类ID",request.querystring("id"),0,8)
sql="select * from wapls_link_cat where cat_id="&cat_id
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -