www.gusucode.com > 栽豆迷你博客 MiniBlog 3.0 正式版源码程序 > Admin_Ing.asp

    <!--#include file="include/conn.asp" -->
<!--#include file="include/const.asp" -->
<!--#include file="include/const_admin.asp" -->
<!--#include file="include/Function.asp" -->
<%
Dim Action,model,rs
Action=Request("action")
model=CheckStr(Request("model"))
Admin.Header
Response.Write "<div class=wtable><div class=wtable_name>印迹数据管理</div><div class=wtable_cont>"
Select Case Action
Case "save"
Dim issue,ticks,content
content=CheckStr(Request("content"))
issue=ValidInteger(Request("issue")):If issue="" then issue=0:Else issue=1:End If
ticks=ValidInteger(Request("ticks")):If ticks="" then ticks=0
Caluoob.Execute("update cb_ing set content='"&content&"',issue="&issue&",ticks="&ticks&" where id="&model)
Response.Write "<p align=center><a href=javascript:history.go(-1)>操作已成功,请返回。</a></p>"
Case "del"
Set rs=Caluoob.Execute("select userid from cb_ing where id="&model)
	If not(rs.eof) then
	Caluoob.Execute("delete from cb_ing where id="&model)
	Caluoob.Execute("delete from cb_reing where Ingid="&model)
	Caluoob.Execute("update cb_user set FavCount=FavCount-1 where id="&Rs(0))
	Caluoob.Execute("update cb_system set allfav=allfav-1")
	End If
	Rs.close:set Rs=nothing
Response.Redirect Request.ServerVariables("http_referer")
Case "edit"
Set Rs=Caluoob.Execute("Select top 1 * From cb_ing Where id = "&model)
If Not(Rs.eof or Rs.bof) then
%>
<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#DADADA">
  <form method="post" action="?action=save&model=<%=Rs("id")%>">
  <tr bgcolor="white">
    <td>推荐:</td>
    <td><input name="issue" type="checkbox" id="issue" style="border:0; background:white;" value="0" <%if rs("issue")=1 then Response.Write "checked"%> /></td>
  </tr>
  <tr bgcolor="white">
    <td>点击:</td>
    <td><input name="ticks" type="text" id="ticks" value="<%=Rs("ticks")%>" style="width:300px;" /></td>
  </tr>
  <tr bgcolor="white">
    <td>时间:</td>
    <td><%=Rs("addtime")%></td>
  </tr>
  <tr bgcolor="white">
    <td valign="top">内容:</td>
    <td><textarea name="content" rows="5" id="content" style="width:300px;"><%=Server.HTMLEncode(Rs("content"))%></textarea></td>
  </tr>
  <tr bgcolor="white">
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="修改" />
      <input type="reset" name="Submit" value="重置" />
      <input type="button" name="button" value="返回" onclick="javascript:history.go(-1)" /></td>
  </tr>
  </form>
</table>
<%
else
Response.Write "<p align=center><a href=javascript:history.go(-1)>很遗憾,系统中不存在名称为 "&user&" 的帐户,请返回。</a></p>"
end if
rs.close
Set rs=nothing
Case Else
%>
<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#DADADA">
	  <tr bgcolor=#FFFFFF><td colspan=7 align="center">
	  <table border="0" cellspacing="0" cellpadding="5">
      <form method="get">
	    <tr>
          <td><a href="Admin_Ing.asp">按最新加入</a> <a href="?by=times">按时间倒序</a> <a href="?by=ontick">按点击排序</a>  <a href="?by=onissue">按推荐排序</a> 根据用户名查询</td>
          <td><input name="user" type="text" id="user" /></td>
          <td><input type="submit" value="查询" /></td>
        </tr>
		</form>
      </table>
	    </td>
	  </tr>
      <tr align="center">
        <td width="65%" bgcolor="#E6EBF7">内容</td>
		<td width="10%" bgcolor="#E6EBF7">添加日期</td>
        <td width="5%" bgcolor="#E6EBF7">点击</td>
        <td width="5%" bgcolor="#E6EBF7">推荐</td>
        <td width="15%" bgcolor="#E6EBF7">操作</td>
      </tr>
<%
Dim Sqlstr,AllPage,Page,MaxPage,StrHreF,jj,by,PublicUrl
by=request("by")
	Select Case by
		Case Isnull(by)
		StrHreF="?"
		Case Else
		StrHreF="?by="&by&"&"
	End Select
	If model<>"" then StrHreF=StrHreF&"model="&model&"&"
	StrHreF=StrHreF&"p="
	MaxPage=20
	page=ValidInteger(Request("p"))
	If page="" then page=1
	If Not IsObject(Conn) Then ConnectionDatabase
	Caluoob.SqlQueryNum=Caluoob.SqlQueryNum+1
	Set Rs=Server.CreateObject("Adodb.Recordset")   
	Sqlstr = "Select id,content,issue,ticks,addtime from [cb_ing]"
	If model<>"" then Sqlstr = Sqlstr &" where id="&model
	Sqlstr = Sqlstr &" order by"
		Select Case by
			Case "times"
				Sqlstr = Sqlstr &" Addtime Asc ,"
			Case "ontick"
				Sqlstr = Sqlstr &" Ticks Desc,"
			Case "onissue"
				Sqlstr = Sqlstr &" issue=1 and Addtime,"
		End Select
	Sqlstr = Sqlstr &" id Desc"
	Rs.Open sqlstr,conn,1,1
	If rs.eof or rs.bof Then
		Response.Write "<tr bgcolor=#FFFFFF><td colspan=8>无数据</td></tr>"
	Else
		AllPage=rs.RecordCount
		rs.MoveFirst
		rs.Move (Page-1)*MaxPage
		For jj=1 to MaxPage
	If rs(2)=1 then
		PublicUrl="<font color=red>是</font>"
	Else
		PublicUrl="<font color=#666666>否</font>"
	End If
%>
      <tr bgcolor=white>
        <td><a href="statuses.asp?id=<%=rs(0)%>" target="_blank">[浏览]</a> <%=rs(1)%></td>
		<td align="center"><%=Caluoob.TimeToStr(rs(4))%></td>
        <td align="center"><%=rs(3)%></td>
        <td align="center"><%=PublicUrl%></td>
        <td align="center"><a href="?action=edit&model=<%=rs(0)%>">修改</a> | <a href="?action=del&model=<%=rs(0)%>">删除</a></td>
      </tr>
<%
rs.movenext
	If rs.EOF Then Exit For
	next
Response.Write "<tr bgcolor=#FFFFFF><td colspan=7>"&SubClassPage(Page,MaxPage,AllPage,StrHreF)&"</td></tr>"
end if
rs.close:set rs=nothing
%>
</table>
<%
End Select
Response.Write "</div></div>"
Admin.Footer
%>