开始论坛上有朋友说要html?name=***&passw=***效果,一直没回复,抱歉。
但是代码非常不完善,所以我想集大家的力量一起完善它:
总共三个页面:test.htm/control.asp/write.asp
test.htm:
1<form action="control.asp" method="post" name="fire"></form>
1<script language="javascript">fire.submit()</script>
control.asp
1@language="vbscript"
1
2if Request.ServerVariables("REQUEST_METHOD")="POST" then
3Application.Lock
4Application("locked") = "locked"
5dim PreURL
6dim phtml,rhtml
7dim htmlPath
8dim sp
9dim htmlstr
10htmlstr = ""
11htmlstr = htmlstr & "
<html>"&vbnewline
htmlstr = htmlstr & "<head>"&vbnewline
htmlstr = htmlstr & "<meta 0""="" content="" expires""="" http-equiv=""/>"&vbnewline
htmlstr = htmlstr & "<meta cache-control""="" content="" http-equiv="" no-cache""=""/>"&vbnewline
htmlstr = htmlstr & "<meta content="" http-equiv="" no-cache""="" pragma""=""/>"&vbnewline
htmlstr = htmlstr & "<title>伪服务器页面演示</title>"&vbnewline
htmlstr = htmlstr & "</head>"&vbnewline
PreURL = Request.ServerVariables("HTTP_REFERER")
if InStr(PreURL,"?")<1 then
htmlPath = left(PreURL,InStrRev(PreURL,"/",-1))
rhtml = right(PreURL,len(PreURL)-InStrRev(PreURL,"/",-1))
htmlstr = htmlstr & "<body #c0c0c0""="" #ffffff""="" bgcolor="" text="">"&vbnewline
htmlstr = htmlstr & "<h4 align="" center""="">这是一个<font #ff0000""="" color="">没带QueryString</font>参数的html页面</h4>"&vbnewline
htmlstr = htmlstr & "<a "&rhtml&"?id='1""' href="">查看带有QueryString参数的html页面</a><br/>"&vbnewline
else
sp = left(PreURL,Instr(PreURL,"?")-1)
htmlPath = left(sp,InStrRev(sp,"/",-1))
rhtml = right(sp,len(sp)-InStrRev(sp,"/",-1))
htmlstr = htmlstr & "<body #000000""="" #fffff0""="" bgcolor="" text="">"&vbnewline
htmlstr = htmlstr & "<h4 align="" center""="">这是一个<font #0000ff""="" color="">带有QueryString</font>参数的html页面</h4>"&vbnewline
htmlstr = htmlstr & "<a "&rhtml&"""="" href="">查看没带QueryString参数的html页面</a><br/>"&vbnewline
end if
htmlstr = htmlstr & "现在是北京时间:"&now()&"<br/>"&vbnewline
htmlstr = htmlstr & "您的IP地址是:"&request.ServerVariables("REMOTE_ADDR")&vbnewlinee
htmlstr = htmlstr & "</body>"&vbnewline
htmlstr = htmlstr & "</body></html>
1"
2set fso = Server.CreateObject("Scripting.FileSystemObject")
3set nf = fso.CreateTextFile(Server.MapPath(rhtml),true)
4nf.write htmlstr
5nf.close
6set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
7xmlhttp.open "POST",htmlPath&"write.asp",true
8xmlhttp.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
9xmlhttp.send "file="&rhtml
10if xmlhttp.readyState<>4 then
11response.redirect PreURL
12end if
13Application("locked") = "unlocked"
14Application.UnLock
15else
16response.redirect "test.htm"
17end if
write.asp
1
2dim file
3file = request.form("file")
4if Request.ServerVariables("REQUEST_METHOD")="POST" then
5Application.Lock
6Application("locked") = "locked"
7set fso = Server.CreateObject("Scripting.FileSystemObject")
8set nf = fso.CreateTextFile(Server.MapPath(file),true)
9nf.writeline "
<form action="" control.asp""="" fire""="" method="" name="" post""=""></form>
1"&chr(10)
2nf.writeline "
<script javascript""="" language="">fire.submit()</script>
1"
2nf.close
3Application("locked") = "unlocked"
4Application.UnLock
5end if
---------------------------------------------------------------
你的思路是正确的,但如果要实现你所需要的效果,却不是最优的..
个人认为在客户端直接通过分析widnow.location串,然后通过xmlhttp或隐藏框架传递参数给服务端页面,通过xmlhttp回调函数在客户端更新效果会更好..
---------------------------------------------------------------
我不知道楼主的出发点到底是什么?
我的google.jnkc.net中还是以.jnkc?name=***&pass=***的效果出现的呢!
HTML也可以用同样的方法啊!
---------------------------------------------------------------
不好意思 ,以前没有见过,所以随便问下
"html?name=***&passw=***效果"
"伪html活动服务器效果"
是用来做什么的 ?有什么用呢?