专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »Asp教程 » asp字符替换器:ASP字符查找替换器 »正文

asp字符替换器:ASP字符查找替换器

来源: 发布时间:星期四, 2008年9月25日 浏览:118次 评论:0
最近我维护的一个网站(某净化工程网站)要修改几个词,但是这个词在网站上很多,而且整个网站的页面有数百个,如果一个一个修改或者本地修改后ftp上传的话,相当耗时间。我记的个webshell有个批量替换的功能,不过当我ftp上传这个文件的时候,却发现找不到这个文件,估计是被杀毒给灭了。
索性自己写一个ASP版的字符替换工具(下载地址http://www.sdclear.cn/OtherFile/tihuan.rar)。其实实现这个功能很简单。用FSO(Scripting.FileSystemObject)对象的OpenTextFile方法打开一个文件,把文件内容读取到一个变量,利用Replace方法替换掉需要替换的字符,然后把替换后的变量的内容写回到文件。
代码如下:


<%
’*******************
’asp版字符替换器
’ByAir
’QQ:153580616
’*******************
%>
<formid=\"form1\"name=\"form1\"method=\"post\"action=\"\">
<label></label>
<p>
<label></label>
</p>
<br/>
<tablewidth=\"520\"border=\"0\"align=\"center\"cellpadding=\"5\"cellspacing=\"1\"bgcolor=\"#66CC99\">
<trbgcolor=\"#FFFFFF\">
<tdheight=\"40\"colspan=\"2\"align=\"center\"bgcolor=\"#57DB9C\"><strong>ASP版字符替换器</strong></td>
</tr>
<trbgcolor=\"#FFFFFF\">
<tdalign=\"center\">网站目录:</td>
<td><label>
<inputname=\"WebMuLu\"type=\"text\"id=\"WebMuLu\"size=\"40\"value=\"<%ifRequest(\"WebMuLu\")<>\"\"ThenResponse.Write(Request(\"WebMuLu\"))elseResponse.Write(Server.MapPath(\"./\"))EndIf%>\"/>
</label></td>
</tr>
<trbgcolor=\"#FFFFFF\">
<tdwidth=\"127\"align=\"center\">文件后缀:</td>
<tdwidth=\"373\"><inputname=\"HouZhui\"type=\"text\"id=\"HouZhui\"value=\"<%IfRequest(\"HouZhui\")<>\"\"ThenResponse.Write(Request(\"HouZhui\"))ElseResponse.Write(\"asp,html,htm\")EndIf%>\"size=\"40\"/></td>
</tr>
<trbgcolor=\"#FFFFFF\">
<tdalign=\"center\">替换模式:</td>
<td><label>
<inputname=\"isReplace\"type=\"checkbox\"id=\"isReplace\"<%IfRequest(\"isReplace\")<>\"\"ThenResponse.Write(\"Checked\")%>value=\"yes\"/> [Page]
</label></td>
</tr>
<trbgcolor=\"#FFFFFF\">
<tdalign=\"center\">查找内容:</td>
<td><textareaname=\"MuMaContent\"cols=\"38\"rows=\"4\"id=\"MuMaContent\"><%ifRequest(\"MuMaContent\")<>\"\"ThenResponse.Write(Request(\"MuMaContent\"))%></textarea></td>
</tr>
<trbgcolor=\"#FFFFFF\">
<tdalign=\"center\">替换内容:</td>
<td><textareaname=\"ReplaceStr\"cols=\"38\"rows=\"4\"id=\"ReplaceStr\"><%ifRequest(\"ReplaceStr\")<>\"\"ThenResponse.Write(Request(\"ReplaceStr\"))%></textarea></td>
</tr>
<trbgcolor=\"#FFFFFF\">
<tdheight=\"40\"colspan=\"2\"align=\"center\"><inputtype=\"submit\"name=\"Submit\"value=\"搜索\"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<label>
<inputtype=\"reset\"name=\"Submit2\"value=\"重置\"/>
</label></td>
</tr>
</table>
<br/>
</form>
<%
FunctionBianLi(path)
Setfso=Server.CreateObject(\"Scripting.FileSystemObject\")
onerrorresumenext

相关文章

读者评论

  • 共0条 分0页

发表评论

  • 昵称:
  • 内容: