标题: 一段用ASP查看ASP文件源码的程序
问天
元帅
Rank: 1


元帅勋章 终身成就勋章
UID 11493
精华 187
积分 34221
帖子 33355
威望 91
金币 13148
热心 2619
阅读权限 100
注册 2006-4-7
状态 离线
一段用ASP查看ASP文件源码的程序

<%
SUB PrintLine (ByVal strLine)
    strLine=server.HTMLEncode(strLine)
    strLine=replace(strLine,"&;amp;lt;%","<FONT COLOR=#ff0000>&;amp;lt;%")
    strLine=replace(strLine,"%&;amp;gt;","%&;amp;gt;</FONT>")
    strLine=replace(strLine,"&;amp;lt;SCRIPT","<FONT COLOR=#0000ff>&;amp;lt;SCRIPT",1,-1,1)
    strLine=replace(strLine,"&;amp;lt;/SCRIPT&;amp;gt;","&;amp;lt;/SCRIPT&;amp;gt;</FONT>",1,-1,1)
    strLine=replace(strLine,"&;amp;lt;!--","<FONT COLOR=#008000>&;amp;lt;!--",1,-1,1)
    strLine=replace(strLine,"--&;amp;gt;","--&;amp;gt;</FONT>",1,-1,1)
    Response.Write strLine
END SUB
Function ShowCode(filename)
    Dim strFilename
    Dim FileObject, oInStream, strOutput     


    strFilename = filename
    Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
    Set oInStream = FileObject.OpenTextFile(strFilename, 1, 0, 0 )
    While NOT oInStream.AtEndOfStream
        strOutput = oInStream.ReadLine
        Call PrintLine(strOutput)
        Response.Write("<BR>")
    Wend
end function
%>
<HTML>
<HEAD>
<TITLE>ASP源码浏览器</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<form action=viewcode.asp method=post>
请输入ASP文件名
<input type=file name=filename>
<input type=submit value="查看源程序">
</form>
<%
on error resume next
dim file
file=request.form("filename")
response.write file &;amp; "源程序如下<hr>"
if trim(file)<> "" then
  call showcode(file)  
end if
%>
</FONT>
</BODY>
</HTML>

网友 问天 签名 - 网友社区 请您回个帖。谢谢
PR查询 免费域名 免费空间
顶部
[广告] 免费域名(Free Subdomain) 免费空间(Free hosting) PR查询(Google Pagerank)



当前时区 GMT+8, 现在时间是 2008-11-23 17:14
信产部ICP备案:京ICP备05066424号 北京市公安局网监备案:1101050648号

Powered by Discuz! 5.5.0
清除 Cookies - 联系我们 - 网友俱乐部 - Archiver - WAP