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

📄 log_lib.asp

📁 blog 程序 DIV BLOG 0.6 Readme [ http://www.IamTing.com ] DIV BLOG 0.6版更新说明 =====================
💻 ASP
📖 第 1 页 / 共 2 页
字号:
'dim k
'k=0
sub getcatlist
	lcode=lcode&"<a href='index.asp'>首 页</a>&nbsp;|"		
	sql="SELECT * FROM log_cat ORDER BY xh DESC"
	set catList=conn.EXECUTE(sql)
	    do while not catList.eof
	       if catlist("ifhide")=0 or isad<0 then
               lcode=lcode&" <a href='index.asp?vt=bycat&cat_id="&catList("ID")&"'>"&catList("cat_name")&"</a> |" 
            
               end if
         'Redim Preserve CN(k)=catList("cat_name")
         'Redim Preserve CI(k)=catlist("id")
         k=k+1
	     catList.MoveNext
	     Loop
	 set catList=nothing
	 lcode=lcode&"&nbsp;<a href='http://www.iamting.com/showlog.asp?cat_id=31&log_id=555' alt='下载本版BLOG'>下载本版BLOG</a>"
end sub
'getcatlist


'============================================获取TOP5 Comment列表
dim tcode

function FormatTitle(str)
if len(trim(str))>=24 then 
FormatTitle=left(trim(str),23)&"..." 
else 
FormatTitle=trim(str)
end if 
end function 

sub getTop
    tcode=tcode

dim top
dim SQL
set top = Server.CreateObject("ADODB.Recordset")
SQL = "select top 5 log_r.*,log_cat.id from log_r,log,log_cat where log_r.log_id = log.log_id and log.cat_id = log_cat.id order by log_r.log_r_id desc"    '更改查询条件为联合查询,以取得cat_id by Poorfish
top.open SQL,conn,1,1

i = 0
total = 0

if top.Eof or top.Bof then
   tcode=tcode&"<li>Sorry,暂时没有评论</li>"
end if
do until top.Eof or total = 5

tcode=tcode&"<li> "&i+1 &". <a href=showlog.asp?log_id="& top("log_ID") &"&cat_id="&top("id")&"#mark_"&top("log_r_id")&">"& unHtml(FormatTitle(top("log_r_content"))) &"</a></li>"    '加入cat_id及锚 by Poorfish
top.MoveNext          
i = i + 1
total = total + 1
loop                  

set top=nothing
'conn.Close
'set conn = nothing

'    tcode=tcode&"<li><a href='clist.asp' class='eng'>More...</a></li>"
end sub
'getTop


'============================================获取RSS
dim rsscode
sub getRss
    rsscode="<table width=100% border=0 cellspacing=1 cellpadding=2 bgcolor=#CCCCCC><tr><td bgcolor=#eff3f7>"
	rsscode=rsscode&"<a href='rss1.asp' target='_blank'><img src='images/rss100.png' width='80' height='15' vspace='2' hspace='2' border='0' alt='可用rss1.asp?cat_id=xxx选择只查看某分类'></a>"
	rsscode=rsscode&"<a href='rss2.asp' target='_blank'><img src='images/rss200.png' width='80' height='15' vspace='2' hspace='2' border='0' alt='可用rss2.asp?cat_id=xxx选择只查看某分类'></a>"
	rsscode=rsscode&"</td></tr>"
	rsscode=rsscode&"<tr><td align='center' bgcolor='#eff3f7'><a href='http://www.creativecommons.cn/licenses/by-nc-sa/1.0/' target='_blank'><img src='http://creativecommons.org/images/public/somerights.gif' border='0' alt='创作共用协议'>"
	rsscode=rsscode&"</td></tr></table>"
end sub
'getRss


'====================================================搜索用表单代码
dim cs
sub getcatinoption
cs=""
			sql="SELECT * FROM log_cat ORDER BY xh DESC"
			set catList=conn.EXECUTE(sql)
			do while not catList.eof
	if catlist("ifhide")=0 or isad<0 then
	cs=cs&"<option value='"&catlist("ID")&"'>"&catList("cat_name")&"</option>"
           
        end if
			catList.MoveNext
			Loop
			set catList=nothing
end sub

dim sccode
sub getsearchcode
	sccode=sccode&"<form name='form1' method='post' action='index.asp?vt=search'>"
    sccode=sccode&"<select name='cat_id'><option VALUE=''>所有分类</option>"
    getcatinoption
    sccode=sccode&cs&"</select>"
	sccode=sccode&"&nbsp;&nbsp;<input type='text' name='key' value='搜索日志内容' onBlur=""if(this.value=='') if(this.style.backgroundColor='#eaf7f8')this.value='搜索日志内容'"" onFocus=""if(this.value.indexOf('搜')!=-1) if(this.style.backgroundColor='#FFFFFF')this.value=''"" onMouseOver=this.focus() />"
	sccode=sccode&"&nbsp;&nbsp;<input type='image' onClick='return check(this.form)' src='images/SearchSubmit.gif' name='submint' value='search' alt='搜索' id='submitButton' align='middle' /></form>"
end sub
'getsearchcode
'====================================================日历代码
redim linkdays(2,0)
linkcount=0

dim ccode
sub calenda(c_year,c_month,c_day)

if c_year="" then c_year=year(Now())
if c_month="" then c_month=month(Now())
if c_day="" then c_day=0

c_year=cint(c_year)
c_month=cint(c_month)
c_day=cint(c_day)
'===============================================添加连接
sql="SELECT l_day,l_month,l_year FROM log WHERE l_year="&c_year&" AND l_month="&c_month&" order by l_day"
set rs_month=conn.EXECUTE(sql)
dim theday
theday=0

do while not rs_month.eof
if rs_month("l_day")<>theday then
theday=rs_month("l_day")

redim preserve linkdays(2,linkcount)
linkdays(0,linkcount)=rs_month("l_month")
linkdays(1,linkcount)=rs_month("l_day")
linkdays(2,linkcount)="index.asp?vt=byday&l_year="&rs_month("l_year")&"&l_month="&rs_month("l_month")&"&l_day="&rs_month("l_day")
linkcount=linkcount+1
end if
rs_month.MoveNext
Loop
set rs_month=nothing
'===================================================

dim mname(12) 
mname(0)=""
mname(1)="一月 "
mname(2)="二月 "
mname(3)="三月"
mname(4)="四月 "
mname(5)="五月 "
mname(6)="六月 "
mname(7)="七月 "
mname(8)="八月 "
mname(9)="九月 "
mname(10)="十月 "
mname(11)="十一月 "
mname(12)="十二月 "

dim mdays(12)
mdays(0)=""
mdays(1)=31
mdays(2)=28
mdays(3)=31
mdays(4)=30
mdays(5)=31
mdays(6)=30
mdays(7)=31
mdays(8)=31
mdays(9)=30
mdays(10)=31
mdays(11)=30
mdays(12)=31


'今天的年月日
today=day(Now()) 
tomonth=month(Now())
toyear=year(Now())

'指定的年月日及星期

thismonth=c_month
thisdate=c_day
thisyear=c_year
If IsDate("February 29, " & thisyear) Then mdays(2)=29

'确定日历1号的星期
startspace=weekday( thismonth&"-1-"&thisyear )-1


ccode="<div id=""NowTime"">"&mname(thismonth)& thisyear&"</div>"
ccode=ccode&"<div id=""MyDate"">"
ccode=ccode&"<div id=""Week"">日</div>"
ccode=ccode&"<div id=""Week"">一</div>"
ccode=ccode&"<div id=""Week"">二</div>"
ccode=ccode&"<div id=""Week"">三</div>"
ccode=ccode&"<div id=""Week"">四</div>"
ccode=ccode&"<div id=""Week"">五</div>"
ccode=ccode&"<div id=""Week"">六</div>"

for s=0 to startspace-1
ccode=ccode&"<div></div>"
next

count=1
while count<=mdays(thismonth)
     for b=startspace to 6
         thisbgcolor=ca_day_color
         if count=today and thisyear=toyear and thismonth=tomonth then thisbgcolor=ca_today_color
         if count=thisdate then thisbgcolor=ca_nowday_color
         ccode=ccode&"<div>"
         linktrue="false"
         for c=0 to ubound(linkdays,2)
             if linkdays(0,c)<>"" then
                if linkdays(0,c)=thismonth and linkdays(1,c)=count then
                   
                   ccode=ccode&"<a href='"&linkdays(2,c)&"'>"
                   linktrue="true"
                end if
             end if
         next
         if count<=mdays(thismonth) then ccode=ccode&count
         if linktrue="true" then ccode=ccode&"</a>"
         ccode=ccode&"</div>"
         count=count+1
     next
     startspace=0
wend
ccode=ccode&"</div>"

nextmonth=c_month+1
nextyear=c_year
if nextmonth>12 then 
nextmonth=1
nextyear=nextyear+1
end if
promonth=c_month-1
proyear=c_year
if promonth<1 then 
promonth=12
proyear=proyear-1
end if

ccode=ccode&"<div id=""ChangeYear"">"
ccode=ccode&"<a href='index.asp?vt=bymonth&l_year="&proyear&"&l_month="&promonth&"'><img src='images/leftarrow.gif' id='Linkimg' alt='上个月' /></a> MONTH <a href='index.asp?vt=bymonth&l_year="&nextyear&"&l_month="&nextmonth&"'><img src='images/rightarrow.gif' id='Linkimg' alt='下个月' /></a>  <a href='index.asp?vt=byyear&l_year="&l_year-1&"&l_month="&l_month&"'><img src='images/leftarrow.gif' id='Linkimg' alt='上一年' /></a> YEAR <a href='index.asp?vt=byyear&l_year="&l_year+1&"&l_month="&l_month&"'><img src='images/rightarrow.gif' id='Linkimg' alt='下一年' /></a>"
ccode=ccode&"</div>"

end sub

%>

⌨️ 快捷键说明

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