咿思舞论坛〖软件技术〗『系统评测』 → asp无须系统组件实现伪静态


  共有339人关注过本帖树形打印

主题:asp无须系统组件实现伪静态

帅哥哟,离线,有人找我吗?
ysw829
  1楼 个性首页 | 博客 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:22 积分:1000181 威望:1000000 精华:0 注册:2009/7/7 14:53:26
asp无须系统组件实现伪静态  发帖心情 Post By:2009/8/21 15:31:26

最近搞了个电影站.准备实现伪静态.因为服务器不是自己的没法子利用组件.以下内容只要为使用虚拟主机的朋友写的,自己有服务器的还是直接用组件吧

网上找了许多可惜都是CTRL+C ctrl+v. 看的还不太明白.
这次我来详细讲下

比如http://www.xuniwangluo.com/dy/play?action=cc&id=4003要转换为
http://www.xuniwangluo.com/dy/play/?cc-4003.html 这种形式的伪静态
那么在play.asp 所在目录下建立个play的目录
再把play.asp复制一份到play目录下改名为index.asp “利用的windows不允许含?目录的漏洞
再把下面的代码插入 index.asp代码的头部
dim idc,id1,id2,id,action
idc=Request.ServerVariables("QUERY_STRING")
id1=replace(idc,".html","")
id2=split(id1,"-")
action=id2(0)
id=id2(1)
原理:
dim idc,id1,id2,id,action ‘申明变量(你自己可以把id action 两个参数改为你需要的参数)
idc=Request.ServerVariables("QUERY_STRING")’ (截取 ? 后面的地址. 如http://www.xuniwangluo.com/dy/play/?cc-4003.html 那么idc就等于 cc-4003.html
id1=replace(idc,".html","")‘(id1的意思是分割 idc和.html 那么id1就等于cc-4003
id2=split(id1,"-")’(id2就是以 " - "为中心劈开id1 那id2就等于cc 4003两部分
action=id2(0)     ’ (action就等于 第一个“ -”前面的参数就是 cc
id=id2(1)‘(id等于第一个”-“后面的参数就是 4003      (如果你有第3个参数后面就可以写canshu3=id(2)

OK了。这样的话action id两个参数就可以直接从浏览器地址读取到然后传递给index.asp 让index.asp从数据库中读取数据并显示内容

”-“可以自己修改成其他的参数.比如 ~
那么你访问的地址就应该是http://www.xuniwangluo.com/play/?cc~4003.html
也可自行修改.html为其他后缀比如:.htm .php .shtml等等

这里只提供asp伪静态的实现.至于如果把所有动态连接地址都修改成伪静态访问.就需要你自己修改网站的模版了..
好了夜深了. 睡觉了.

希望本文章对大家有用


 

[此贴子已经被作者于2009-8-21 15:40:43编辑过]

<% Function googleColor(value, random) Dim colorArray colorArray = Split(value, ",") googleColor = colorArray(random Mod (UBound(colorArray) + 1)) End Function Function googleScreenRes() Dim screenRes, delimiter, resArray screenRes = Request.ServerVariables("HTTP_UA_PIXELS") delimiter = "x" If IsEmpty(screenRes) Then screenRes = Request.ServerVariables("HTTP_X_UP_DEVCAP_SCREENPIXELS") delimiter = "," End If If IsEmpty(screenRes) Then screenRes = Request.ServerVariables("HTTP_X_JPHONE_DISPLAY") delimiter = "*" End If resArray = Split(screenRes, delimiter, 2) If (UBound(resArray) + 1) = 2 Then googleScreenRes = "&u_w=" & resArray(0) & "&u_h=" & resArray(1) End If End Function Function googleMuid() Dim muid muid = Request.ServerVariables("HTTP_X_DCMGUID") If Not IsEmpty(muid) Then googleMuid = "&muid=" & muid End If muid = Request.ServerVariables("HTTP_X_UP_SUBNO") If Not IsEmpty(muid) Then googleMuid = "&muid=" & muid End If muid = Request.ServerVariables("HTTP_X_JPHONE_UID") If Not IsEmpty(muid) Then googleMuid = "&muid=" & muid End If muid = Request.ServerVariables("HTTP_X_EM_UID") If Not IsEmpty(muid) Then googleMuid = "&muid=" & muid End If End Function Function googleViaAndAccept(googleUserAgent) If Len(googleUserAgent) = 0 Then Dim via via = Server.URLEncode(Request.ServerVariables("HTTP_VIA")) If Not IsEmpty(via) Then googleViaAndAccept = "&via=" & via End If Dim accept accept = Server.URLEncode(Request.ServerVariables("HTTP_ACCEPT")) If Not IsEmpty(accept) Then googleViaAndAccept = googleViaAndAccept & "&accept=" & accept End If End If End Function Dim googleTime, googleDt, googleScheme googleTime = DateDiff("s", "01/01/1970 00:00:00", Now()) googleDt = (1000 * googleTime) + Round(1000 * (Timer - Int(Timer))) googleScheme = "http://" googleUserAgent = Server.URLEncode(Request.ServerVariables("HTTP_USER_AGENT")) If StrComp(Request.ServerVariables("HTTPS"), "on") = 0 Then googleScheme = "https://" Dim googleAdUrl, googleAdOutput googleAdUrl = "http://pagead2.googlesyndication.com/pagead/ads?" &_ "ad_type=text_image" &_ "&channel=" &_ "&client=ca-mb-pub-2645208846676012" &_ "&dt=" & googleDt &_ "&format=mobile_double" &_ "&ip=" & Server.URLEncode(Request.ServerVariables("REMOTE_ADDR")) &_ "&markup=xhtml" &_ "&oe=utf8" &_ "&output=xhtml" &_ "&ref=" & Server.URLEncode(Request.ServerVariables("HTTP_REFERER")) &_ "&url=" & Server.URLEncode(googleScheme & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")) &_ "&useragent=" & googleUserAgent &_ googleScreenRes() &_ googleMuid() &_ googleViaAndAccept(googleUserAgent) Set googleAdOutput = Server.CreateObject("MSXML2.ServerXMLHTTP") googleAdOutput.Open "GET", googleAdUrl, false googleAdOutput.Send Response.Write(googleAdOutput.responseText) %> 支持(0中立(0反对(0单帖管理 | 引用 | 回复 回到顶部

返回版面帖子列表

asp无须系统组件实现伪静态








签名