|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
源代码保护方面其实现在考虑得没那么多了..NET也可以反编译.ASP写得复杂的话别人能看得懂的话.他也有能力自己写了.这方面担心的倒不太多.纵观现在网上可以下载的那些所谓BBS还有什么网站等等的源代码分页|显现CodeTitle:Paging(modifiable)
Description:Addpagingtoyourrecordretrieval.But,doitwiththegoodolformfieldthatallowsyou
tojusttypeindirectlywhatpageyawannagoto.Thisoneisourfave!Itevenalternatesthebackground
color(bgcolor)ofeachrow,tomakeviewingtherecordseteveneasier..Weusedifferenttweakedversions
ofthisonealloveroursite!SeeanexampleofthiscodesnippetonourInternationalpage.
Wehavemadeitsothatitwilldisplayahyperlinkedfirstiteminonecolumn,thenatruncated
descriptionusingtheLeft()functioninthenextcolumn.Thehyperlinkwilltakeyoutothespecific
articleorrecord,(whateveryoureusingitfor).
Weuseajavascriptvalidnumbercheckeronthisone,justtomakesurethepersondoesntenteranyweird
charactersintothepagenumberfieldoftheform.Wedontnormallydothis,butifyawantthe
javascriptfornumberchecking,checkoutourjsNumberValidator.
Copyandpastethissnippetas-isintoyoureditor:
<%
ConstadUseClient=3
ConstadOpenStatic=3
specific=Request.QueryString("specific")
Ifspecific=""Then
Setrs=Server.CreateObject("ADODB.RecordSet")
rs.CursorLocation=adUseClient
rs.CacheSize=5
mypage=Request.Form("pgNum")
Ifmypage=""Thenmypage=1
rs.Open"SELECT*FROMTABLEORDERBYFIELDASC",cnDZ,adOpenStatic
IfNotrs.EOFThen
rs.MoveFirst
rs.PageSize=20changethisnumbertoexactlyhowmanyrecordsperpageyawannashow
maxcount=cint(rs.PageCount)
rs.AbsolutePage=mypage
howmanyrecs=0
Response.Write"<tableborder=0>"
LinkCount=0
WhileNotrs.EOFAndhowmanyrecs<rs.pagesize
IfLinkCountMod2=0ThenbgColor="bgcolor=#F0F0F0"ElsebgColor=""
Response.Write"<tr"&bgColor&"><tdnowrap>"&_
"<ahref=""myPage.asp?specific="&rs("ID")&""">"&rs("FIELD")&"</a></td>"&_
"<tdwidth=""100%""nowrap>"&Left(rs("FIELD2"),40)&"</td></tr>"
LinkCount=LinkCount+1
rs.MoveNext
howmanyrecs=howmanyrecs+1
Wend
Response.Write"</table>"
Ifmaxcount>1Then
Ifmypage+1>maxcountThennextPg=1ElsenextPg=mypage+1
Response.Write"<formmethod=postaction=""myPage.asp"">"&_
"<nobr>Page"&mypage&"of"&maxcount&"NavigatetoPage:<input
type=textname=pgNumsize=3maxlength=3value="""&nextPg&"""><inputtype=submitname=gopgNum
value=GO></nobr></form>"
EndIf
ElseResponse.Write"Sorry,nothingisavailableatthemoment."
EndIf
rs.Close
Setrs=Nothing
Else
Setrs=cnDZ.Execute("SELECT*FROMTABLEWHEREID="&specific&"")
DoUntilrs.EOF
Response.Write""&rs("FIELD")&"<br>"&_
""&rs("FIELD2")&"<br>"
rs.MoveNext
Loop
rs.Close
Setrs=Nothing
EndIf
%>
</p>ASP脚本是采用明文(plaintext)方式来编写的。 |
|