快讯

一个显示原代码的asp程序

2004-02-14 09:33  出处:eNet硅谷动力  作者:enet  责任编辑:zwg 

< html > < head > < title > view cgi_code(.asp or .php) < /title > < /head > < body > < form action="view_code.asp" method="POST" > 请输入路径:< input type=text name="code_path" > 请选择类型:< select name="cgi_type" > < option value="asp" >asp< /option > < option value="php" >php< /option > < /select > < input type=submit > < /form > < hr > < % if vartype(request.servervariables("HTTP_REFERER")) then ’判断该页面是否是由其他的页面申请提交,若用户是直接在浏览器中输入地址 而来的,则HTTP_REFERER环境变量应该没有被初始化 if request.servervariables("REQUEST_METHOD")="POST" then code_path=request.form("code_path") cgi_type=request.form("cgi_type") response.write("下面的代码来自表格的提交:"&"< br >") response.write("路径为:"&code_path&"< br >") elseif request.servervariables("REQUEST_METHOD")="GET" then code_path=request.querystring("code_path") cgi_type=request.querystring("cgi_type") response.write("下面的代码来自"&code_path&"的提交:"&"< br >") response.write("路径为:"&code_path&"< br >") end if ’根据提交方式的不同显示不同的提示 set fileobject=server.createobject("Scripting.FileSystemObject") if fileobject.fileexists(code_path) then ’检查要打开的文件是否存在 set stream=fileobject.opentextfile(code_path,1,false,0) while not stream.atendofstream stroutput=stream.readline call printline(stroutput,line_check(stroutput,cgi_type),cgi_type) ’将该文件的每一行都分别交给printline来处理 response.write("< br >") wend set stream=nothing else response.write("不能打开文件"&"< br >") end if end if % > < /body > < /html >
键盘也能翻页,试试“← →”键
IT热词搜索 来源:360新闻
软件论坛帖子排行
相关文章

相关软件:

腾讯QQ2012
大小:52.93 MB 授权:免费
腾讯QQ2012
立即下载
腾讯QQ2013
大小:49.32 MB 授权:免费
腾讯QQ2013
立即下载