📄 link.asp
字号:
<% option explicit %>
<!--#include file="../function1/DBOpen.asp"-->
<%
if session("purview")<>"99999" then
response.write "错误!!您没有权限或者连接超时,请重新登陆." %>
<a href="../login.asp" target="_top">登陆</a>
<% response.end
end if
dim isedit '是否在修改状态
dim color '表格颜色
dim sql,rs,rsc
dim writer '录入员
writer=""
color=1
isedit=false
if request("action")="edit" then
isedit=true
end if
if request("action")="modify" then '**************************修改链接*********************
if trim(request("linkname"))="" then
response.write "错误!链接名称不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
set rs=server.createobject("adodb.recordset") '检查链接是否重名
rs.open "select * from link where linkname='" & trim(request("linkname")) & "' and linkid<>" & cstr(request("linkid")),conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else if not rs.bof and not rs.eof then
response.write "错误!该链接已存在! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
end if
rs.close
set rs=nothing
sql="update link set linkname='" & cstr(trim(request("linkname"))) & "' ,link='" & cstr(trim(request("link"))) & "'where linkid=" & cstr(request("linkid"))
conn.execute sql
if err.number <> 0 then
response.write "数据库操作出错:" + err.description
else %>
<script language=vbscript>
msgbox "操作成功!链接 <%=trim(request("linkname"))%> 的信息已经更新!"
</script>
<%end if
end if
if request("action")="add" then '******************************添加新链接************************
if trim(request("linkname"))="" then
response.write "错误!链接名称不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
set rs=server.createobject("adodb.recordset") '检查链接是否重名
rs.open "select * from link where linkname='" & trim(request("linkname")) & "'",conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else if not rs.bof and not rs.eof then
response.write "错误!该链接已存在! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
end if
rs.close
set rs=nothing
sql="insert into link(linkname,link) values('" & trim(request("linkname")) & "','" & trim(request("link")) & "')"
conn.execute sql
if err.number <> 0 then
response.write "数据库操作出错:" + err.description
end if%>
<script language=vbscript>
msgbox "操作成功!新链接 <%=trim(request("linkname"))%> 的信息添加成功!"
</script>
<%
end if
if request("action")="del" then '**********************删除链接**********************
sql="delete from link where linkid=" & cstr(request("linkid"))
conn.execute sql
if err.number <> 0 then
response.write "数据库操作错误:" + err.description
err.clear
else
%>
<script language=vbscript>
msgbox "操作成功!该链接的所有相关信息已删除!"
</script>
<% end if
end if
%><html>
<head>
<title>大类管理</title>
<meta http-equiv="Content-link" content="text/html; charset=gb2312">
<div align="center">
<STYLE>TABLE {FONT-SIZE: 12px;COLOR: #000000; FONT-FAMILY: 宋体;LINE-HEIGHT: 180%}
.Shadow_white {FONT-SIZE: 14pt; FILTER: dropshadow(color:black, offx=1, offy=1, positive=1); WIDTH: 70%; COLOR: #000000; FONT-FAMILY: 宋体; POSITION: relative}
.Shadow_white2 {FONT-SIZE: 10pt; FILTER: dropshadow(color:black, offx=1, offy=1, positive=1); WIDTH: 70%; COLOR: #000000; FONT-FAMILY: 宋体; POSITION: relative}
A:link {COLOR: #000000; TEXT-DECORATION: none}
A:active {COLOR: #000000; TEXT-DECORATION: none}
A:visited {COLOR: #000000; TEXT-DECORATION: none}
A:hover {COLOR: #ff0000; TEXT-DECORATION: underline}
</STYLE></head>
<body>
<script language=JavaScript>
function SureDel(id)
{
if ( confirm("确定删除这个链接吗?"))
{
window.location.href = "link.asp?action=del&linkid=" + id
}
}
</script>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from link",conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else
if rs.bof and rs.eof then
rs.close
response.write "目前没有任何链接"
else %>
<table border="0" width="70%" bgcolor="#000000" cellpadding="0" cellspacing="1" align="center">
<tr bgcolor="#abb8d6">
<td height="38" colspan="3">
<div align="center"></div> <div align="center"></div>
<div align="center"><font size="4"><b>友情链接管理</b></font></div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="44%">
<div align="center">-----链接名称-----</div>
</td>
<td width="45%">
<div align="center">链接地址</div>
</td>
<td width="11%">
<div align="center">操作</div>
</td>
</tr>
<% do while not rs.eof %>
<tr>
<td width="44%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#ffffff"
end if %>">
<div align="center"><a href='link.asp?linkid=<%=cstr(rs("linkid"))%>&action=edit'><%=rs("linkname")%></a></div>
</td>
<td width="45%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#ffffff"
end if %>">
<div align="center"><a href='link.asp?linkid=<%=cstr(rs("linkid"))%>&action=edit'><%=rs("link")%></a></div>
</td>
<td width="11%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#ffffff"
end if %>">
<div align="center"><a href='javascript:SureDel(<%=cstr(rs("linkid"))%>)'>删除</a></div>
</td>
</tr>
<% rs.movenext
color=color+1
loop
end if
end if
'rs.close
set rs=nothing
%>
</table>
<table width="70%" border="0" cellspacing="0" cellpadding="0" bgcolor="#abb8d6" style="border: 1px solid #000000">
<tr>
<td height="100">
<form action="link.asp" method="post">
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="30">
<div align="center">
<% if isedit then
set rs=server.createobject("adodb.recordset")
rs.open "select * from link where linkid=" & cstr(request("linkid")),conn,1,1
response.write "<b>编 辑链接</b><br>"
else
response.write "<b>添 加 新 链接</b><br>"
end if %>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<input type="Hidden" name="action" value='<% If isedit then%>modify<% Else %>add<% End If %>'>
<%If isedit then%>
<input type="Hidden" name="linkid" value='<%=cstr(request("linkid"))%>'>
<%End If%>
链接名称:
<input type="text" name="linkname" class=input maxlength=50 size="50" value='<% if isedit then
response.write trim(rs("linkname"))
end if %>'>
<br>
链接地址:
<input name="link" type="text" class=input id="link" value='<% if isedit then
response.write trim(rs("link"))
end if %>' size="50" maxlength=50>
<br>
<input type=submit value="确 定" class=button name="submit">
<br>
</div>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
<p align="center"> </p>
</body>
</html>
<!--#include file="../function/DBclose.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -