设为首页
加入收藏
站内地图
旧版入口
当前位置:首页 > 站长学院 > 网络编程 > ASP

运行asp脚本的asp脚本

作者:佚名 出处:网络转载 时间:05-28 点击:

内容载入中...
 

写这个小东西的出发点,由于经常的需要在线利用asp脚本的ado对数据库执行建表,修改字段
每次都要ftp修改升级文件传上去或在线修改好了运行!很是麻烦
于是写了这个小东西!很方便~~

脚本特点:
1.可以运行除了 ssi(如#include file) 和 预处理指令(如@ language=javascript)外的任何 asp vbscript 脚本
比如数据库连接,记录集的建立,甚至Fso等
2.并可运行<%%> <%=%> HTML混编的 ASP脚本
3.有简单的容错处理机制,可以简单的知道是脚本那个部分错误
4.具有验证码登陆,密码和用户名在代码runasp.asp 的头部修改,缺省提供的是帐号:admin 密码:admin

看起来这个脚本很简陋,其实功能极其强大的可怕!
虽然有简单的登陆验证,但还是不建议你使用在你的站点上,做为一个辅助调试asp代码的小工具
个人认为比较实用的!所以你可以自己测试,玩玩,或作为临时的论坛代码解决问题的测试工具!
因为每次都要进入调试环境来运行asp的确麻烦!
还需要注意一点的是象 <td width=50%> 的50%一定要写加引号

演示(admin 密码admin):
www.paintblue.net/myasp/runasp.asp
(实际执行功能已经屏蔽,请下载或粘贴下面代码测试使用):

下载:
 http://www.paintblue.net/myasp/runasp.rar

 

<% @ LANGUAGE="VBSCRIPT" %>
<%Option Explicit
response.buffer=true
dim Spassword,SUserName
 SUserName="admin"
 Spassword="admin"
dim SQLMutiStr
dim i
dim action
 action=request.querystring("action")

IF action="GetCode" then '---------TOT
 NumCodeJS
ELSE '--------TOT
 Response.Write("<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">")
 Response.Write("<HTML>")
 Response.Write("<HEAD>")
 Response.Write("<TITLE>ASP RunCode SCR V1.0 / Create By PaintBlue.Net V37</TITLE>")
 Response.Write("<META NAME=""Generator"" CONTENT=""EditPlus,V37,PaintBlue.Net"">")
 Response.Write("<META NAME=""Author"" CONTENT=""V37,PaintBlue.Net"">")
 Response.Write("<META NAME=""Keywords"" CONTENT=""PaintBlue.Net,,V37,RunCode,ASP,Script,BlueIdea.COM,Lfgbox.com"">")
 Response.Write("<META NAME=""Description"" CONTENT=""运行ASP代码的ASP脚本!"">")
 Response.Write("</HEAD>")
 Response.Write("<BODY bgcolor=#D4D0C8>")

 SQLMutiStr=trim(Request.Form("SQLMutiStr"))
 if session("login")="" and action="chkpass" then
  session("login")=checkPass()
 end if
 if action="exit" then session("login")=""
 if session("login")="1" then
   if action="RunCode" then 
    if SQLMutiStr="" then
     Response.write "没有输入要运行的代码!"
     Response.write "<br><br><a href=""javascript:window.history.back();"">返回运行页面</a><br><br>"
     Response.write "<a href=""?action=exit"">退出登陆</a>"
     response.end
    else
     dim ExeStrArr
     dim re
     dim tempSQL,tempSQL2
      dim ScriptArr,ScriptSubArr
      tempSQL2=""
     tempSQL=split(SQLMutiStr,vbcrlf)
     if inStr(lcase(tempSQL(0)),"language")>0 then
      tempSQL2=tempSQL(1)
      if ubound(tempSQL)>1 then
       for i=1 to ubound(tempSQL)
        tempSQL2=tempSQL2&tempSQL(i)
       next
      end if
      tempSQL2=trim(tempSQL2)
     else
      tempSQL2=SQLMutiStr
     end if
      tempSQL2=replace(tempSQL2,"<%"&"=","<"&"%response.write ")
      do
       tempSQL2=replace(tempSQL2,vbcrlf&vbcrlf,vbcrlf)
      loop while instr(tempSQL2,vbcrlf&vbcrlf)>0
       tempSQL2=trim(tempSQL2)
       tempSQL2="<"&"%%"&">"&tempSQL2&"<"&"%%"&">"
       ScriptArr=split(tempSQL2,"%"&">")
      dim ub,kub
       ub=ubound(ScriptArr)
      for i=0 to ub-1
       ScriptSubArr=split(ScriptArr(i),"<"&"%")
       if i>0 then response.write (ScriptSubArr(0))
       ExeCuteIt(ScriptSubArr(1))
      next
     call EndProc("<font color=#009900>代码运行完毕!</font>")
    end if
   else
    %>
    输入要运行的ASP代码:
    <FORM METHOD=POST ACTION="?action=RunCode" style="margin:0px;">
document.getElementById('loading').style.display="none";

收藏本文:
】【打印页面】【推荐给朋友】【关闭窗口

站长学院

推荐信息