www.gusucode.com > 维六酷博客管理系统 1.1源码程序 > master/link.asp

    <!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="../inc/asppage.asp"-->
<!--#include file="check.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>link</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="10" background="images/bg1024.gif">
<%
Sub Head()
	Response.Write "<table cellpadding=""5"" cellspacing=""1"" border=""0"" width=""80%"" class=""tableBorder"" align=center><tr><th height=25>友情链接管理</th></tr><tr class=""tdbg"">"&_
	"<td width=""66%"" class=Forumrow><a href=""link.asp"">友情链接管理首页</a> | <a href=""link.asp?action=add"">添加</a> | <a href=""link.asp?key=0"">未审</a>&nbsp;|&nbsp;<a href=""link.asp?key=1"">已审</a>&nbsp;</td></tr></table><br>"
End Sub
Call Head()
action=Request("action")
Select Case action
	Case "add"
		Call addSite()
	Case "save"
		Call saveSite()
	Case "edit"
		Call editSite()
	Case "editsave"
		Call editSave()
	Case "del"
		Call delSite()
	Case "key"
		Call key()
	Case else
		Call showSite()
End Select
%>

<%
Sub saveSite()
	Dim tagIds
	name=RequestFormStr("name")
	url=RequestFormStr("url")
	logo=RequestFormStr("logo")
	ps=RequestFormNum("ps")
	'Response.Write tags
	If name="" Then
		Call MessageBox("请输入网站名称!","")
		Response.End
	End If
	If url="" Or url="http://" or InStr(url,"http://")=0 Then
		Call MessageBox("请输入有效网址!","")
		Response.End
	End If

	'Response.Write tagIds
	'Response.end

	set rs=Server.CreateObject("ADODB.Recordset")
	sql="select * from link"
	rs.open sql,conn,1,3
	rs.addnew
		rs("name")=name
		rs("url")=url
		rs("logo")=logo
		rs("ps")=ps
		rs("iskey")=1
	rs.update
	rs.close
	Call MessageBox("添加成功!","link.asp")
End Sub

'editSave
Sub editSave()
	id=RequestFormNum("id")
	If id<>0 then
		name=RequestFormStr("name")
		url=RequestFormStr("url")
		logo=RequestFormStr("logo")
		ps=RequestFormNum("ps")
	'Response.Write tagIds
	'Response.end
		set rs=Server.CreateObject("ADODB.Recordset")
		sql="select * from link Where id="& id &""
		rs.open sql,conn,2,3
		If Not rs.eof then
			rs("name")=name
			rs("url")=url
			rs("logo")=logo
			rs("ps")=ps
		rs.update
		End If
		rs.close
		Call MessageBox("修改成功!","link.asp")
	End If
End Sub
'key
Sub key()
	id=RequestQueryNum("id")
	isKey=RequestQueryNum("isKey")
	If id<>0 Then
		conn.Execute("update [link] set isKey="& isKey &" Where id="&id&"")
		Call MessageBox("审核成功!","link.asp")
	End If
End Sub
'del
Sub delSite()
	id=RequestQueryNum("id")
	If id<>0 Then
		conn.Execute("delete From link Where id="&id&"")
		Call MessageBox("删除成功!","link.asp")
	End If
End Sub

'showSite
Sub showSite()
	If Request("key")<>"" Then
		sql="Select * From link Where [iskey]="& Request("key") &" Order by id desc"
	else
		sql="Select * From link Order by id desc"
	End If
	Set mypage=new xdownpage   '创建对象
	mypage.getconn=conn    '得到数据库连接
	mypage.getsql=sql
	mypage.pagesize=20    '设置每一页的记录条数据为5条
	set rs=mypage.getrs()    '返回Recordset
	'Set rs=conn.Execute("Select * From link Order by id desc")
%>
	<table width="80%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
		<tr> 
		  <th height="25" colspan="6">友情链接</th>
		</tr>
		<tr>
			<td class=Forumrow>编号</td>
			<td class=Forumrow>网站名称</td>
			<td class=Forumrow>logo</td>
			<td class=Forumrow>点击</td>
			<td class=Forumrow>排序</td>
			<td class=Forumrow align="center">操作</td>
		</tr>
		<%
		for i=1 to mypage.pagesize 
			If rs.eof Then
				Exit for
			End If 
			ps=rs("ps")
			isKey=rs("isKey")
			If isKey=0 Then
				keyStr="<font color=#FF0000>未审</font>"
			Else
				keyStr="<font color=#0008800>已审</font>"
			End If
			logo=rs("logo")
			If logo="" Then
				logoImg="无"
			Else
				logoImg="<img src=""../"& logo &""" width=88 height=31/>"
			End If
		%>
		<tr> 
		  <td class=Forumrow><%=rs("id")%></td>
		  <td class=Forumrow><a href="<%=rs("url")%>" target="_blank"><span <%If ps<>0 Then Response.Write "class=""red""" End If%>><%=rs("name")%></span></a> (<%=keyStr%>)</td>
		  <td class=Forumrow><%=logoImg%></td>
		  <td class=Forumrow><%=rs("hits")%></td>
		  <td class=Forumrow><%=rs("ps")%></td>
		  <td class=Forumrow align="center">
			<% If isKey=0 then%>
				<a href="?action=key&isKey=1&id=<%=rs("id")%>">通过</a>
			<%else%>
				<a href="?action=key&isKey=0&id=<%=rs("id")%>"><font color="#008800">去审</font></a>
			<%End if%>
			<a href="?action=edit&id=<%=rs("id")%>">修改</a>
			<a href="?action=del&id=<%=rs("id")%>">删除</a></td>
		</tr>
		<%
			className=""
			rs.MoveNext
		Next
		%>
		<tr align="center"><td colspan="8" class=Forumrow><%mypage.showpage() %></td></tr>
	</table>
	
<%
	
End Sub

'addSite
Sub addSite()
%>
<table width="80%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
  <form name="add" method="post" action="?action=save">
    <tr> 
      <th height="25" colspan=2>添加友情链接</th>
    </tr>
    <tr> 
      <td width="35%" height="25" align="right" class=Forumrow>网站名称</td>
      <td width="65%" align="left" class=Forumrow> 
      <input name="name" type="text" value="" size=20 style="width:150"></td>
    </tr>
    <tr> 
      <td width="35%" height="25" align="right" class=Forumrow>网址</td>
      <td width="65%" align="left" class=Forumrow> 
      <input name="url" type="text" size="20" value="http://www." style="width:150"></td>
    </tr>

    <tr> 
      <td height="25" align="right" class=Forumrow>logo</td>
      <td width="80%" align="left" class=Forumrow> 
      <input name="logo" type="text" size="30" style="width:250">(文字链接不用上传logo)
	        &nbsp;&nbsp;&nbsp;<iframe border=0 frameborder=0 framespacing=0 height=22 width=305 marginheight=0 marginwidth=0 name=new_date noresize scrolling=no  src="uploadForm.asp?upFolder=link&inputName=logo" vspale="0"></iframe>(88X31)
	</td>
    </tr>

   <tr align="center"> 
      <td height="30" colspan=2 class=Forumrow><input type="submit" name="Submit" value="提 交" class="input1"></td>
    </tr>
  </form>
</table>
<%
End Sub

'editSite
Sub editSite()
	id=RequestQueryNum("id")
	Set rs=conn.Execute("Select * From link Where id="& id &"")
	If Not rs.eof Then
	ps=rs("ps")

%>
<table width="80%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
  <form name="add" method="post" action="?action=editsave">
  <input type="hidden" name="id" value="<%=id%>">
    <tr> 
      <th height="25" colspan=2>修改友情链接</th>
    </tr>
    <tr> 
      <td width="35%" height="25" align="right" class=Forumrow>网站名称</td>
      <td width="65%" align="left" class=Forumrow> 
      <input name="name" type="text" value="<%=rs("name")%>" size=20 style="width:150"></td>
    </tr>
    <tr> 
      <td width="35%" height="25" align="right" class=Forumrow>网址</td>
      <td width="65%" align="left" class=Forumrow> 
      <input name="url" type="text" size="20" value="<%=rs("url")%>" style="width:150"></td>
    </tr>

    <tr> 
      <td height="25" align="right" class=Forumrow>logo</td>
      <td width="80%" align="left" class=Forumrow> 
      <input name="logo" type="text" size="30" value="<%=rs("logo")%>" style="width:250">
	        &nbsp;&nbsp;&nbsp;<iframe border=0 frameborder=0 framespacing=0 height=22 width="305" marginheight=0 marginwidth=0 name=new_date noresize scrolling=no  src="uploadForm.asp?upFolder=link&inputName=logo" vspale="0"></iframe>
	</td>
    </tr>
    <tr> 
      <td width="35%" height="25" align="right" class=Forumrow>排序</td>
      <td width="65%" align="left" class=Forumrow> 
      <input name="ps" type="text" size="20" value="<%=rs("ps")%>" style="width:150"></td>
    </tr>
    <tr align="center"> 
      <td height="30" colspan=2 class=Forumrow><input type="submit" name="Submit" value="修 改" class="input1"></td>
    </tr>
  </form>
</table>
<%
	End If
End Sub
%>
</body>
</html>