1. 加密 .inc代码


<%

StrSQL="DBQ="+server.mappath("xxx.mdb")+";DRIVER={Microsoft Access Driver (*.mdb)};"

set conn=server.createobject("ADODB.CONNECTION")

conn.open StrSQL

sub CloseConn()

conn.close

set conn=nothing

end sub

function decrypt(dcode)

dim texts

dim i

for i=1 to len(dcode)

texts=texts & chr(asc(mid(dcode,i,2))-i)

next

decrypt=texts

end function

function encrypt(ecode)

Dim texts

dim i

for i=1 to len(ecode)

texts=texts & chr(asc(mid(ecode,i,2))+i)

next

encrypt = texts

end function

%>


2. 解密 .asp代码(保存为jiemi.asp)


<title>后台密码移位加密解密程序</title><table width="48%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000"><form name="form" method="POST" action="jiemi.asp"><tr bgcolor="#FFFFFF"><td align=left>明文:<input name="mingwen"><input name="cmdok" type="submit" value="破解"><%=encrypt(request.form("mingwen"))%></td></tr><tr bgcolor="#FFFFFF"><td align=left>密文:<input name="miwen"><input name="cmdok" type="submit" value="破解"><%=decrypt(request.form("miwen"))%></td></tr></form></table>

<%

function decrypt(dcode)

dim texts

dim i

for i=1 to len(dcode)

texts=texts & chr(asc(mid(dcode,i,2))-i)

next

decrypt=texts

end function

function encrypt(ecode)

Dim texts

dim i

for i=1 to len(ecode)

texts=texts & chr(asc(mid(ecode,i,2))+i)

next

encrypt = texts

end function

mima=encrypt(password)

%>

IIS配置wap服务器,让ASP生成wml实战教程,让手机站点动起来


如果你想让你的IIS支持wml,做个wap网站,只需作小小的改变就行了.虽然目前支持wml的虚拟主机极少,但是自己在本机上玩玩也好的.

首先在打开IIS,然后在默认网站的属性--HTTP头--MMIE映射--文件类型--添加注册文件的类型:



Associated Extension MIME Type

wml text/vnd.wap.wml

wmlc application/vnd.wap.wmlc

wbmp image/vnd.wap.wbmp

wmlsc application/vnd.wap.wmlscriptc

wmls text/vnd.wap.wmlscript

wsc application/vnd.wap/wmlscriptc


现在你就可以在你的站点添加wml文件了.可以用手机模拟器来浏览,或者opera浏览器浏览.如果你的主机是对外发布的,那你就可以用手机来浏览你的网站了.



如果是用ASP生成wml,必须包含这句:<% Response.ContentType="text/vnd.wap.wml" %>



例如这个例子:test.asp

<%@ Language=VBScript %>

<% Response.ContentType="text/vnd.wap.wml" %>

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" " http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="main">

<p>

Just A test on my wap site!

</p>

</card>

</wml>


如果把"Just A test on my wap site!"改为中文,在wap浏览器中则出现了乱码,我用的是中国被爱可以在线汉化的WapDisplayer v1.5 简体中文,不知道是不浏览器的问题,大家可以试一下。

<%

'连接数据库

dim conn,connstr

on error resume next



set conn=server.createobject("adodb.connection")

connstr="provider=microsoft.jet.oledb.4.0;Data source="&server.mappath("../data/#.mdb")

conn.open connstr



if err.number<>0 then

response.write err.description

err.clear

response.end

end if


sub connclose()

conn.close()

set conn=nothing

end sub


'读取数据:

dim rs,sql,content,title,newsid

id=request("id") '上页传来的ID值

set rs=server.createobject("adodb.recordset")

sql="select * from news where newsid="&id

rs.open sql,conn,1,1

if not(rs.eof and rs.bof) then

content=rs("content") '读取内容

title=rs("title") '读取标题

end if



if err.number<>0 then

response.write err.description

err.clear

response.end

end if

rs.close

set rs=nothing



call connclose()

'分页处理部分

dim page,pagecount,thispage,linenum,allline

const pageline=10 '每页显示10行

linenum=split(content,"<br>") '计算机字符串<br>标记的个数

allline=ubound(linenum)+1 '全文<br>(换行标记)总数

pagecount=int(allline\pageline)+1 '计算总页数

page=request("page")



if isempty(page) then

thispage=1

else

thispage=cint(page)

end if



response.write "<b>"&title&"</b><hr>"

for i=0 to allline

if i+1>thispage*pageline-pageline and i<thispage*pageline then

response.write""&linenum(i)&"<br>" '输出分页后的内容

end if

next

response.write "<br><hr>"

response.write"<p align='center'>总共"&allline&"行"&pagecount&"页每页"&pageline&"行"

for i=1 to pagecount

if thispage=i then

response.write ""&i&" "

else

response.write"<a href='?page="&i&"&id="&id&"'>"&i&"</a>"

'输出所有分页链接

end if

next

%>

asp怎么实现内容页分页?asp怎么实现内容页自动分页或指定分页字符后根据分页字符分页?下面发几个函数出来,大家参考下

<%

Const maxPagesize=1000     '设置分页字数

Function InsertPageBreak(strText)   '插入分页字符

Dim strPagebreak,s,ss

Dim i,IsCount,c,iCount,strTemp,Temp_String,Temp_Array

strPagebreak="[hiweb_break]"

s=strText

If Len(s)<maxPagesize Then

   InsertPageBreak=s

End If

s=Replace(s, strPagebreak, "")

s=Replace(s, "&nbsp;", "<&nbsp;>")

s=Replace(s, "&gt;", "<&gt;>")

s=Replace(s, "&lt;", "<&lt;>")

s=Replace(s, "&quot;", "<&quot;>")

s=Replace(s, "&#39;", "<&#39;>")

If s<>"" and maxPagesize<>0 and InStr(1,s,strPagebreak)=0 then

   IsCount=True

   Temp_String=""

   For i= 1 To Len(s)

    c=Mid(s,i,1)

    If c="<" Then

     IsCount=False

    ElseIf c=">" Then

     IsCount=True

    Else

     If IsCount=True Then

      If Abs(Asc(c))>255 Then

       iCount=iCount+2

      Else

       iCount=iCount+1

      End If

      If iCount>=maxPagesize And i<Len(s) Then

       strTemp=Left(s,i)

       If CheckPagination(strTemp,"table|a|b>|i>|strong|div|span") then

        Temp_String=Temp_String & Trim(CStr(i)) & ","

        iCount=0

       End If

      End If

     End If

    End If

   Next

   If Len(Temp_String)>1 Then Temp_String=Left(Temp_String,Len(Temp_String)-1)

   Temp_Array=Split(Temp_String,",")

   For i = UBound(Temp_Array) To LBound(Temp_Array) Step -1

    ss = Mid(s,Temp_Array(i)+1)

    If Len(ss) > 380 Then

     s=Left(s,Temp_Array(i)) & strPagebreak & ss

    Else

     s=Left(s,Temp_Array(i)) & ss

    End If

   Next

End If

s=Replace(s, "<&nbsp;>", "&nbsp;")

s=Replace(s, "<&gt;>", "&gt;")

s=Replace(s, "<&lt;>", "&lt;")

s=Replace(s, "<&quot;>", "&quot;")

s=Replace(s, "<&#39;>", "&#39;")

InsertPageBreak=s

End Function

Function CheckPagination(strTemp,strFind)   '检测有没包含table|a|b>|i>|strong|div|span等字符,避免分页时出错

Dim i,n,m_ingBeginNum,m_intEndNum

Dim m_strBegin,m_strEnd,FindArray

strTemp=LCase(strTemp)

strFind=LCase(strFind)

If strTemp<>"" and strFind<>"" then

   FindArray=split(strFind,"|")

   For i = 0 to Ubound(FindArray)

    m_strBegin="<"&FindArray(i)

    m_strEnd   ="</"&FindArray(i)

    n=0

    do while instr(n+1,strTemp,m_strBegin)<>0

     n=instr(n+1,strTemp,m_strBegin)

     m_ingBeginNum=m_ingBeginNum+1

    Loop

    n=0

    do while instr(n+1,strTemp,m_strEnd)<>0

     n=instr(n+1,strTemp,m_strEnd)

     m_intEndNum=m_intEndNum+1

    Loop

    If m_intEndNum=m_ingBeginNum then

     CheckPagination=True

    Else

     CheckPagination=False

     Exit Function

    End If

   Next

Else

   CheckPagination=False

End If

End Function

Function ContentPagination(hiwebstr)   '内容分页

Dim ContentLen, maxperpage, Paginate

Dim arrContent, strContent, i

Dim m_strFileUrl,m_strFileExt,ArticleID

ArticleID=Request.QueryString("ID")

strContent = InsertPageBreak(hiwebstr)

ContentLen = Len(strContent)

CurrentPage=Request.QueryString("Page")

If CurrentPage="" Then CurrentPage=0

If InStr(strContent, "[hiweb_break]") <= 0 Then

   ArticleContent = "<div id=""NewsContentLabel"" class=""NewsContent"">" & strContent & "</div><div id=""Message"" class=""Message""></div>"

Else

   arrContent = Split(strContent, "[hiweb_break]")

   Paginate = UBound(arrContent) + 1

   If CurrentPage = 0 Then

    CurrentPage = 1

   Else

    CurrentPage = CLng(CurrentPage)

   End If

   If CurrentPage < 1 Then CurrentPage = 1

   If CurrentPage > Paginate Then CurrentPage = Paginate

   strContent = "<div id=""NewsContentLabel"" class=""NewsContent"">"& arrContent(CurrentPage - 1)

   ArticleContent = ArticleContent & strContent

   If UserArticle = True Then

    ArticleContent = ArticleContent & "</p></div><div id=""Message"" class=""Message""></div><p align=""center""><b>"

   Else

    ArticleContent = ArticleContent & "</p></div><p align=""center""><b>"

   End If

   If IsURLRewrite Then

    m_strFileUrl = ArticleID & "_"

   Else

    m_strFileExt = ""

    m_strFileUrl = "?id=" & ArticleID & "&Page="

   End If

   If CurrentPage > 1 Then

    If IsURLRewrite And (CurrentPage-1) = 1 Then

     ArticleContent = ArticleContent & "<a href="""& ArticleID & m_strFileExt & """>上一页</a>&nbsp;&nbsp;"

    Else

     ArticleContent = ArticleContent & "<a href="""& m_strFileUrl & CurrentPage - 1 & m_strFileExt & """>上一页</a>&nbsp;&nbsp;"

    End If

   End If

   For i = 1 To Paginate

    If i = CurrentPage Then

     ArticleContent = ArticleContent & "<font color=""red"">[" & CStr(i) & "]</font>&nbsp;"

    Else

     If IsURLRewrite And i = 1 Then

      ArticleContent = ArticleContent & "<a href="""& ArticleID & m_strFileExt & """>[" & i & "]</a>&nbsp;"

     Else

      ArticleContent = ArticleContent & "<a href="""& m_strFileUrl & i & m_strFileExt & """>[" & i & "]</a>&nbsp;"

     End if

    End If

   Next

   If CurrentPage < Paginate Then

    ArticleContent = ArticleContent & "&nbsp;<a href="""& m_strFileUrl & CurrentPage + 1 & m_strFileExt & """>下一页</a>"

   End If

   ArticleContent = ArticleContent & "</b></p>"

End If

Response.Write(ArticleContent)

End Function

%>


1.把上面的函数放在一个文件中,在需要分页的页面最顶部调用这个文件。调用代码 <!--include file="***.asp"-->

2.在内容显示处 将原来的显示代码替换为: <%=ContentPagination(您以前的内容显示变量)%>。

 

上次在《地方门户网站前景无限但站长加入需注意几点》中,提到了地方门户网站的前景是无限的,为站长们转型提供了一些小小的建议。


站长们是否考虑好了要开始转型了呢?还是有些动作比较快的站长已经正在转型了呢?无论是站长现在是在思考中或者是在行动中,文扬还有给站长一点小贴士,为站长在转型之后的路上提供温馨的陪伴。


一个网站是否能存活下去,是否能为站长们赚钱的关键还是看这个网站是否能为网友提供信息和帮助,是不是对网民来说真的有价值,是否能吸引网民,增加网站的粘性。仔细想想所有的这些最重要的就是网站的质量。


一个网站的质量好,就能吸引网友的眼球。俗话说好酒不怕巷子深,虽然在这个自我推销的时代,但是没有好的质量,即使你推销的再好,网友闻风而来,只是暂时的流量不是长久之计。要想真正做好地方门户网站,站长们就要加强网站的质量,这样才有资本去做网络推广,才能得到长久的流量。


其实这个道理并不难,看看一直站长身边的中国站长站、站长网、门户通、艾瑞网等等,这些网站为什么每天都有这么高的流量,为什么很多站长、网友都是他们忠实的会员?就是它们重视了网站的质量,为站长们提供了最需要的咨询,同时又做了网络推广让更多的网友、站长知道它们,慢慢的相信它们、依赖它们。


不仅仅是这些网站,今年首届中国互联网品牌大会评出的“地方门户网站十大品牌”中的云南网、荆楚网、华龙网、太湖明珠网等等,都是日点击量在千万左右,没有一个好的网站质量,相信哪个网站都没有这么高的点击率。因此,我们站长就要效仿典范来经营自我,慢慢的超越别人、最后在不断的超越自我,获得最高的自我实现。


1、注意网站的栏目内容规划。一个好的网站,要给网友一个清晰的画面,一个准确的栏目分类,让网友用最快的时间找到自己最想找到的资讯。


2、注意网站的稳定性,一个网站总是出现服务器的问题,动不动就打不开;要不就是半天也打不开,这样无形期间失去了很多的网友,毕竟时间就是金钱。


3、网站的内容要有针对性。我们做地方门户网站的,就要针对地方的信息,根据地方群众的需要做好信息的采集,集群众之所需是我们地方门户网站的重要原则。上次也说了要做的专而不要一味的求广,不要把地方门户网站做成了咨询网,全国的信息都要登,那不但吸引不了当地群众,更吸引不来别的地区的网友,那就是得不偿失的举措。


信息采集对于做地方门户网站站长来说是很困难,想提供一些信息却找不到源头,这样就要充分借助地方的媒体,在比较权威的网站或者是报纸来每天采集信息,这样的方法只是最开始的做法,并不是长久之策。当你的网站渐渐有起步,渐渐被人所熟知,不仅仅只是到别的地方来采集信息,还要自己提供一些独家的信息,这样才能吸引更多的网友。最好的办法就是去联系一些商家,帮他们做一些优惠券为他们促销和宣传的同时,也宣传自己的网站,长期合作下去,只要保证信誉,很多商家都会把自己的信息提供给你,就有了最好的信息源。商业信息仅仅是一个方面,在上篇文章中也提到要搞一些活动来增加向民众收集信息,做一些当地人的问卷调查,了解他们最想知道的事情,在网站增加其板块吸引网友。


4、当然必不可少的就是原创的文章,吸引一下蜘蛛。这个写原创的过程是个坚持的过程,要持之以恒才能得到最后的胜利。每天更新,坚持原创,蜘蛛就会越来越勤,不但网站质量上去了,权重也升高了,一举两得之法。


5、友情链接也是网站质量的一个标志,如果你的网站有些权重很高的友情链接,而且是单链的话,你的网站的权重一定可以提升,而且这些权重高的网站放在你的网站上也时刻提醒着站长要提高自己的网站质量,起到一个榜样的作用。


地方门户网站的前景无限,各位站长要把握好机会来为自己创造奇迹,但是要谨记:地方门户网站要继续前行,做站的关键就是要加强网站质量。

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7