⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fav.asp

📁 一个不错的论坛原代码
💻 ASP
字号:
<!--#include file="Connections.asp" -->	
<!--#include file="inc_admenu.asp"-->				
<!--#include file="top.asp" -->	
 <%cpbtitle="收藏夹"
 call toptitle(l_title,cpbtitle)
call head(0,cpbusername&"的控制面板首页","userindex.asp",cpbtitle)

if isuser=false then
errormsg="<LI>你还没有登陆,不能操作您的收藏夹,请先<a href=login.asp>登陆</a></LI>"
call error(errormsg)
call login()
else

dim h_friend
 sql="select h_favs from home"
  set rsconn1=conn.execute(sql)
  if not rsconn1.eof then
h_favs=rsconn1("h_favs")
end if
set rsconn1=nothing

%>
 
    <center>
<table border=1 borderColor=<%=tdc2%> cellPadding=0 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse">

   <tr>
 <td class=tdc1  align="center" height="23" <%=tcolor%> width="12%">
    <a href="userindex.asp" class=nav1>用户控制面板</a></td> 
    <td class=tdc1  align="center" height="23" <%=tcolor%> width="12%">
    <a href="edituser.asp?action=editbasic" class=nav1>基本资料修改</a></td> 
    <td class=tdc1  align="center" height="23" <%=tcolor%> width="12%">
    <a href="edituser.asp?action=editlink" class=nav1>联系资料修改</a></td> 
    <td class=tdc1  align="center" height="23" <%=tcolor%> width="12%">
    <a href="edituser.asp?action=editpw" class=nav1>用户密码修改</a></td> 
    <td class=tdc1  align="center" height="23" <%=tcolor%> width="12%">
    <a href="friend.asp" class=nav1>编辑好友列表</a></td> 
    <td class=tdc1  align="center" height="23" <%=tcolor%> width="12%">
    <a href="friend.asp?action=badfriend" class=nav1>编辑忽略列表</a></td> 
    <td class=tdc1  align="center" height="23" <%=tcolor%> width="12%">
    <a href="fav.asp" class=nav1>用户收藏管理</a></td> 
    <td class=tdc1  align="center" height="23" <%=tcolor%> width="12%">
    <a href="pm.asp" class=nav1>用户短信服务</a></td>
   
  </tr>
</table>
<font size="1">&nbsp;</font><br>    </center>


   
<%select case request("action")
case ""
call showfriend()
case "addf"
call addf()
case "add"
call add()
case "删除收藏"
call dellfriend()
case "清空收藏"
call dellallfriend()
case "badfriend"
call badfriend()


end select

sub showfriend()
%>
  <center>
                  
                  

      <table border=1 borderColor=<%=tdc2%> cellPadding=4 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse" align=center>
 
        <tr> 
          <td height="21" width="100%" align="center"  <%=hColor%> class=tdc1 colspan="3" >
          <%=cpbusername%> 的收藏夹</td>
        </tr>
<form action="?" method=post>
  <tr> 
          <td height="21" width="65%" align="center" <%=tColor%> class=tdc1>标题</td>
          <td height="21" width="20%" align="center" <%=tColor%> class=tdc1>时间</td>
          <td height="21" width="15%" align="center" <%=tColor%> class=tdc1> 操作</td>
        </tr>


<%    page=request.querystring("page")
  if page="" then  page=1 
  pages = "10"
set rs=server.createobject("adodb.recordset") 
sql="select f_title,f_url,f_time from favs where f_username='"&cpbusername&"'"
rs.open sql,conn,1,1
if not (rs.BOF or rs.EOF) then
rs.pagesize = pages 
maxpagecount=rs.pagecount
r=cint(rs.RecordCount)'记录总数
rs.absolutepage = page '当前页数
rcount=0
do while not rs.eof and rcount <rs.pagesize
%>

          <tr> 
                       <td height="21" width="65%"  bgcolor=<%=tColor2%> class=tdc><a href="<%=rs("f_url")%>" target=_blank><%=rs("f_title")%></a></td>

            <td height="21" width="20%" align="center"  bgcolor=<%=tColor2%> class=tdc><%=rs("f_time")%></td> 
         
   <td height="21" width="15%" align="center" bgcolor=<%=tColor2%> class=tdc1><INPUT type=radio value=<%=rs("f_url")%> name=f_url></td> </tr>
           <%  rs.MoveNext 
rcount=rcount+1
loop %>
<tr  align="left"> 
            <td colspan="3" bgcolor=<%=tColor2%> class=tdc >
 
 
   <%
            if maxpagecount="" then maxpagecount=1
            if r="" then r=0
pagestart=page-5
pageend=page+5
if pagestart<1 then pagestart=1
if pageend>maxpagecount then pageend=maxpagecount
response.write(" [ ")
if maxpagecount > 6 then Response.Write ("<a href=?page=1>1</a> ... ")
for i=pagestart to pageend
if i<>int(page) then
Response.Write (" <a href=?page="&i&">" & i & "</a> ")
else
Response.Write ("<b>"&i&"</b> ")
end if
next
if maxpagecount > page +5 then Response.Write( " ... <a href=?page="&maxpagecount&">"&maxpagecount&"</a>")
response.write(" ] ")
response.write("..页次:"&page&"/"&maxpagecount&"页   每页:"&pages&" 收藏数:"&r&" ")
%>  </td>  </tr> 
<%

          else%>
            <tr> 
          <td height="21" width="100%" align="center"  bgcolor=<%=tColor2%> class=tdc colspan="5" >
        您的收藏夹中还没有收藏地址</td>
        </tr>
           <% end if%> 
  <tr> 
          <td height="21" width="100%" align="right"  bgcolor=<%=tColor2%> class=tdc colspan="5" >
       <input type=button name=action onclick="location.href='?action=addf'" value="添加收藏" class=bdtj>&nbsp;<input type=submit name=action onclick="{if(confirm('确定删除选定的纪录吗?')){this.document.inbox.submit();return true;}return false;}" value="删除收藏" class=bdtj>&nbsp;<input type=submit name=action onclick="{if(confirm('确定清除所有的纪录吗?')){this.document.inbox.submit();return true;}return false;}" value="清空收藏" class=bdtj></td>
        </tr>
</form>
      </table>

    </center>


<%
end sub
sub addf()%>
<center>
                  
                  

      <table border=1 borderColor=<%=tdc2%> cellPadding=4 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse" align=center>
 
        <tr> 
          <td height="21" width="100%" align="center"  <%=hColor%> class=tdc1 colspan="5" >
          添加收藏</td>
        </tr>
<form action="?action=add" method=post>
 <tr> 
      <td align="right" width="10%" bgcolor=<%=tColor2%> class=tdc>收藏标题:</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        &nbsp;<input type="text" size="20" name="f_title"  class="bdtj" value="">
      </td>
      <td align="right" width="10%" bgcolor=<%=tColor2%> class=tdc>收藏地址:</td>
      <td bgcolor=<%=tColor2%> class=tdc > &nbsp;<input type="text" size="40" name="f_url"  class="bdtj" value=""> 
      </td>
    </tr>
      <tr> 
      <td bgcolor=<%=tColor2%> class=tdc width="15%"> </td>
      <td bgcolor=<%=tColor2%> class=tdc colspan="3"> 
        &nbsp;<input type="submit" name="Submit" value="保存" class="bdtj" >
        <input type="button" value="返回" onClick="JavaScript:history.go(-1)" name="Button" class="bdtj">  
 </td>
    </tr>
    
</form>
      </table>

    </center>

<%
end sub

sub add()
f_title=chktopic(request("f_title"))

if Request.ServerVariables("request_method")="POST" then
f_url=chktopic(request("f_url"))
else
f_url=chktopic(Request.ServerVariables("http_referer"))
end if

if f_title="" or f_url="" then errormsg=errormsg&"<LI>收藏标题或者收藏地址不能为空</li>"
if len(f_title)>50 or len(f_url)>180 then errormsg=errormsg&"收藏标题不能大于50个字节或者收藏地址不能大于180个字节</li>"

acount=0
sql="select count(*) as acount from favs where f_username='"&cpbusername&"'"
set rs=conn.execute(sql)
if not rs.eof then acount=rs("acount")
if acount>=h_favs then errormsg=errormsg&"<LI>您的收藏夹只能存在"&h_favs&"条收藏地址,现在已经有"&acount&"条收藏地址</li>"
sql="select f_title from favs where f_username='"&cpbusername&"' and f_url='"&f_url&"'"
set rs=conn.execute(sql)
if not rs.eof then  errormsg=errormsg&"<LI>收藏地址已经存在,请重新输入</li>"


if  errormsg<>"" then
call error(errormsg)
call bq()
response.end
else
StrSQl="insert into favs (f_title,f_username,f_time,f_url) Values ('"
 strSql = StrSQl & f_title & "', '"
 strSql = StrSQl & cpbusername & "', '"
 strSql = StrSQl & nowtime & "', '"
 strSql = StrSQl & f_url & "')"
 conn.Execute (strsql)
succmsg="<LI>您要加的收藏地址已经添加进收藏夹</LI>"
call succ(succmsg)
end if


end sub

sub dellfriend()
u_friendname1=chktopic(request("f_url"))
if u_friendname1="" then errormsg=errormsg&"<LI>您没有选择要删除的收藏地址</li>"
if  errormsg<>"" then
call error(errormsg)
call bq()
response.end
else
sql="delete from favs where f_username='"&cpbusername&"' and f_url='"&u_friendname1&"'"
conn.execute(sql)
succmsg="<LI>收藏地址已经从您的收藏夹中删除</LI>"
call succ(succmsg)
end if
end sub


sub dellallfriend()
sql="delete from favs where f_username='"&cpbusername&"'"
conn.execute(sql)
succmsg="<LI>您的收藏夹已经清空</LI>"
call succ(succmsg)
end sub
end if%><!--#include file="bq.asp" -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -