www.gusucode.com > WapEditFile手机WAP文件管理器源码 > wap_edit2post.asp

    <!--#include file="wap_common.asp"-->
<!--#include file="wap_check.asp"-->
<!--#include file="wap_verify.asp"-->
<%Response.ContentType="text/vnd.wap.wml; charset=utf-8"%>
<?xml version="1.0" encoding="utf-8"?> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> 
<wml>
<head><meta http-equiv='Cache-Control' content='no-cache'/>
</head>

<card id='wuyumin' title='编辑文件结果'>
<p>
<!--#include file="wap_top.asp"-->
<!--#include file="wap_top_end.asp"-->
</p>
<p>

<%
'--------------------------------------------------
'函数名称:BlackBlockGoAway
'作用:去掉生成的文本文件中的黑块
'--------------------------------------------------
Function BlackBlockGoAway(Str)
if IsNull(str) then exit function
Str=Replace(Str,vbCrLf,vbLf)  '将 回车符+换行符 替换成 换行符,防止误操作   
Str=Replace(Str,vbCr,vbLf)  '将 回车符 替换成 换行符   
Str=Replace(Str,vbLf,vbCrLf)  '将 换行符 替换成 回车符+换行符
BlackBlockGoAway=Str
End Function


'--------------------------------------------------
'函数名称:WriteToTextFile
'作用:利用AdoDb.Stream对象来写入文本文件
'--------------------------------------------------
Function WriteToTextFile(FileUrl,byval Str,CharSet)
If FileUrl="" OR IsNull(FileUrl) Then
WriteToTextFile=""
Exit Function
End If
FileUrl=Server.MapPath(FileUrl)
Dim stm
set stm=server.CreateObject("adodb.stream")
stm.Type=2 '以文本模式读取
stm.mode=3
stm.charset=CharSet
stm.open
stm.WriteText str
stm.SaveToFile FileUrl,2
stm.flush
stm.Close
set stm=nothing
End Function

on error resume next
dim EditFile,CodeFile,EditFileContent
EditFile=trim(request("EditFile"))
CodeFile=trim(request("CodeFile"))
EditFileContent=BlackBlockGoAway(request("EditFileContent"))

call WriteToTextFile (trim(request("EditFile")),EditFileContent,CodeFile)

if err.number<>0 then
response.Write "操作过程中发生错误。请仔细核对一下,再重新操作!"&chr(13)
else
response.Write "恭喜您!您已经成功操作!"&chr(13)
end if
%>

</p>
<p>
<!--#include file="wap_footer_head.asp"-->
<!--#include file="wap_footer.asp"-->
</p>
</card>
</wml>