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

📄 mysarticle.asp

📁 不错的ASP整站源代码。在IIS环境下运行都没有问题
💻 ASP
字号:
<!--#include file="articleconn.asp"--> 
<!--#include file="INC/fun.inc"-->
<!--#include file="inc/part_1.asp"-->
<script language="JavaScript">
<!--
function checkinput()
{
	if (document.search.keyword.value=="")
	 {
		alert("请输入想查询的内容!");
		document.search.keyword.focus();
		return false;
	 }
	 return true;
}
-->
</script>
<br>
<!------------search--------------->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tbody>
                <tr> 
                  <td align="center" bgcolor="#FF99CC" height="1"></td>
                </tr>
                <tr>
                  <td align="center" height="22" bgcolor="#FFD9EC"><font color="#ff0099" class="fontshadow">文章搜索</font></td>
                </tr>
                <tr> 
                  <td align="center" bgcolor="#FF99CC" height="1"></td>
                </tr>
              </tbody>
</table>
<form action="search.asp" method="post" name="search" onsubmit="return checkinput()">
<input type="text" name=keyword size=17 maxlength="30" value="关键字搜索" onFocus=this.value='' class="put">
<input type="Image" src="images/ssearch.gif" tppabs="" align="absmiddle" width="20" height="20" title="查询" id=Image1 name=Image1>
<input type="hidden" name="typeid" value="<%=typeid%>">
</form>
<!--#include file="inc/part_2.asp"-->
<!--#include file="inc/articleCHAR.inc"--> 
<table border="0" cellpadding="0" cellspacing="0" width="95%">
  <tbody>
  <tr><td>
<script language="javascript">
<!--
function popwin2(id,path)
{		window.open("openarticle.asp?id="+id+"&ppath="+path,"","height=500,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
-->
</script>

<%
Set connx = Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("../isi/xlist.asp")
connx.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
'-----------------------------------------------------------------
Set rs_larx = Server.CreateObject("ADODB.Recordset")
sqlx="select netname from larchives where user_id =" & Request("user_id")
rs_larx.open sqlx,connx,1,1

'叛断此用户是否已经提交档案
if rs_larx.eof and rs_larx.bof then
	 response.redirect "../info.asp?msg=错误,没有该会员记录!"
	 response.end
end if
NickName=rs_larx("netname")
rs_larx.close
set rs_larx=Nothing
connx.close
set connx=Nothing	

%>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tbody> 
                <tr height="22"> 
                  <td><img src="../images/arrow.gif" width="12" height="12" align="top" border="0" hspace="0">&nbsp;<font color="#FF0000" class="titletext"><%=NickName%>的个人文集</font>
                  </td>
<%
	If cint(Request("user_id")) = cint(Session("u_id")) Then
%>
                  <td align="right"><a href="addarticle.asp" class="a03">发表文章</a> <a href="default.asp" class="a03">更多的文章</a>
                  </td>
<%
	End If
%>
                </tr>
                <tr> 
                  <td height="1" colspan="2"></td>
                </tr>
                </tbody> 
              </table>

<%
   dim rs
   MaxPerPage=20 'rs("duo")
   dim totalPut   
   dim CurrentPage
   dim TotalPages
   dim i,j
   dim typename
   typename=""
   if not isempty(request("page")) then
      currentPage=cint(request("page"))
   else
      currentPage=1
   end if
   dim sql
   dim rstype
   dim typesql
   dim typeid,typename1
   if not isEmpty(request("typeid")) then
	typeid=request("typeid")
   else
	typeid=0
   end if
 set rstype=server.createobject("adodb.recordset")
  typesql="select * from type where typeid="&typeid&""
 rstype.open typesql,conn,1,1
 if not rstype.eof then
	typename1=rstype("type")
 else typename1="全部文章"	
 end if
 rstype.close

%> 

<%
if typeid=0 then  
   sql="select type.typeid,type.type,learning.articleid,learning.typeid,learning.user_id,learning.name,learning.title,learning.content,learning.dateandtime,learning.reviewcount,learning.hits from learning,type where type.typeid=learning.typeid and learning.user_id=" & request("user_id") & " order by learning.articleid desc"
else  
   sql="select type.typeid,type.type,learning.articleid,learning.typeid,learning.user_id,learning.name,learning.title,learning.content,learning.dateandtime,learning.reviewcount,learning.hits from learning,type where type.typeid=learning.typeid and learning.user_id=" & request("user_id") & " and learning.typeid="+cstr(typeid)+" order by learning.articleid desc"
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
  if rs.eof and rs.bof then
       response.write "<p align='center'> 还 没 有 任 何 文 章</p>"
   else
	  totalPut=rs.recordcount
      totalPut=rs.recordcount
      if currentpage<1 then
          currentpage=1
      end if
      if (currentpage-1)*MaxPerPage>totalput then
	   if (totalPut mod MaxPerPage)=0 then
	     currentpage= totalPut \ MaxPerPage
	   else
	      currentpage= totalPut \ MaxPerPage + 1
	   end if

      end if
       if currentPage=1 then
            showhead totalput,MaxPerPage,"mysarticle.asp"
            showContent
            showpage totalput,MaxPerPage,"mysarticle.asp"
       else
          if (currentPage-1)*MaxPerPage<totalPut then
            rs.move  (currentPage-1)*MaxPerPage
            dim bookmark
            bookmark=rs.bookmark
            showhead totalput,MaxPerPage,"mysarticle.asp"
            showContent
            showpage totalput,MaxPerPage,"mysarticle.asp"
        else
	        currentPage=1
	   showhead totalput,MaxPerPage,"mysarticle.asp"     
           showContent
           showpage totalput,MaxPerPage,"mysarticle.asp"
	      end if
	   end if
   rs.close
   end if
	        
   set rs=nothing  
   conn.close
   set conn=nothing
  

sub showContent
       dim i
	   i=0
%>
<table cellspacing="1" cellpadding="1" border="0" width="100%">
<tbody>
<tr bgcolor="#FF99CC">
<td width="58%">&nbsp;<font color="#FFFFFF">标 题</font></td>
<td width="18%" align="center"><font color="#FFFFFF">类 别</font></td>
<td width="10%" align="center"><font color="#FFFFFF">时 间</font></td>
<td width="7%" align="center"><font color="#FFFFFF">人气</font></td>
<td width="7%" align="center"><font color="#FFFFFF">点评</font></td>
</tr>
<tr>
 <td height="4" colspan="5" bgcolor="#ffe8f0"></td>
<tr>
           <%do while not rs.eof%>
           <tr height="24">
           <td><li><a href="javascript:popwin2(<%=rs("articleid")%>)" class="a06"><%=rs("title")%></a></td>
           <td align="center"><a href="mysarticle.asp?user_id=<%=request("user_id")%>&typeid=<%=rs("typeid")%>"><%=rs("type")%></a></td>
           <td align="center"><%=GetDate(rs("dateandtime"))%></td>
           <td align="center"><%=rs("hits")%></td>
           <td align="center"><%=rs("reviewcount")%></td>
           </tr>
            <% i=i+1
	      if i>=MaxPerPage then exit do
	      rs.movenext
	   loop
		%>
<tr>
 <td height="10" colspan="5"></td>
<tr>
<tr>
 <td height="1" colspan="5" background="../images/hline.gif"></td>
<tr>
</tbody>
</table>          
      <%
end sub 

function showpage(totalnumber,maxperpage,filename)
  dim n
  if totalnumber mod maxperpage=0 then
     n= totalnumber \ maxperpage
  else
     n= totalnumber \ maxperpage+1
  end if
  response.write "<table border=0 cellspacing=0 width=100% cellpadding=0><form method=Post action="&filename&"?typeid="&typeid&"&user_id="&request("user_id")&"><tr><td>"
    if CurrentPage<2 then
    response.write "<font color='#000000'>首页 上一页</font>&nbsp;"
  else
    response.write "<a href="&filename&"?page=1&typeid="&typeid&"&user_id="&request("user_id")&">首页</a>&nbsp;"
    response.write "<a href="&filename&"?page="&CurrentPage-1&"&typeid="&typeid&"&user_id="&request("user_id")&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
    response.write "<font color='#000000'>下一页 尾页</font>"
  else
    response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&typeid="&typeid&"&user_id="&request("user_id")&">"
    response.write "下一页</a> <a href="&filename&"?page="&n&"&typeid="&typeid&"&user_id="&request("user_id")&">尾页</a>"
  end if
   response.write "</td><td align=right><font color='#000000'>&nbsp;页次:</font> <font color=red><b>"&CurrentPage&"</b></font> <font color='#000000'> / <b>"&n&"</b> 页</font>"
    response.write "<font color='#000000'> "
   response.write " <font color='#000000'>转到:</font> <input type='text' name='page' size=3 maxlength=10 class=put value="&currentpage&"> 页"
   response.write "</td></tr></form></table>"
       
end function

function showhead(totalnumber,maxperpage,filename)
  dim n
  if totalnumber mod maxperpage=0 then
     n= totalnumber \ maxperpage
  else
     n= totalnumber \ maxperpage+1
  end if
  response.write "<table border=0 cellspacing=0 width=100% cellpadding=0><tr><td height='26'><a href='Myarticle.asp?typeid="&typeid&"&user_id="&request("user_id")&"' class='a03'>[预览模式]</a> <font color='#000000'>共有 <font color=red><b>"&totalnumber&"</b></font> 篇文章</font></td><td align=right>"
    if CurrentPage<2 then
    response.write "<font color='#000000'>上一页</font>&nbsp;"
  else
     response.write "<a href="&filename&"?page="&CurrentPage-1&"&typeid="&typeid&"&user_id="&request("user_id")&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
     response.write "<font color='#000000'>下一页</font>"
  else
     response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&typeid="&typeid&"&user_id="&request("user_id")&">下一页</a>"
  end if
   response.write "</td></tr></table>"
       
end function
%>
</td></tr>
</tbody>
</table>
<%
Function RmHtml(fString)
	fString = Replace(fString, CHR(13), " ")
	fString = Replace(fString, CHR(10) & CHR(10), " ")
	fString = Replace(fString, CHR(10), " ")
	fString = Replace(fString, "<br>", " ")
	fString = Replace(fString, "<BR>", " ")
	fString = Replace(fString, "<Br>", " ")
	fString = Replace(fString, "<bR>", " ")
	fString = Replace(fString, "<p>", " ")
	fString = Replace(fString, "<P>", " ")
	fString = replace(fString, ">", "&gt;")
	fString = replace(fString, "<", "&lt;")
        RmHtml=fString
End Function
%> 
<!--#include file="inc/part_3.asp"-->

⌨️ 快捷键说明

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