生成html
共有两个页面index.htm是首页.程序比较简单,主要是用了ASP里的文件操作对象。
<!--index.htm---------------------->
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"">
<html>
<head>
<title>UntitledDocument</title>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
</head>
<body>
<tablewidth="770"border="0"align="center"cellpadding="0"cellspacing="0">
<tr>
<td><formname="form1"method="post"action="send.asp">
<tablewidth="100%" border="0"cellpadding="0"cellspacing="0"bgcolor="#CCFFFF">
<tr>
<tdheight="20"><divalign="center">发送消息</div></td>
</tr>
<tr>
<td><divalign="center">
<textareaname="msg"cols="100"rows="6"></textarea>
</div></td>
</tr>
<tr>
<td><divalign="center">
<inputtype="submit"name="Submit"value="Submit">
<inputtype="reset"name="Submit2"value="Reset">
</div></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
'//send.asp
<%
functionchan_time(shijian)'转换日期时间函数
s_year=year(shijian)
iflen(s_year)=2thens_year="20"&s_year
s_month=month(shijian)
ifs_month<10thens_month="0"&s_month
s_day=day(shijian)
ifs_day<10thens_day="0"&s_day
s_hour=hour(shijian)
ifs_hour<10thens_hour="0"&s_hour
s_minute=minute(shijian)
ifs_minute<10thens_minute="0"&s_minute
chan_time=s_year&s_month&s_day&s_hour&s_minute
endfunction
functionchan_data(shijian) '转换日期时间函数
s_year=year(shijian)
iflen(s_year)=2thens_year="20"&s_year
s_month=month(shijian)
ifs_month<10thens_month="0"&s_month
s_day=day(shijian)
ifs_day<10thens_day="0"&s_day
chan_data=s_year&s_month&s_day
endfunction
functionchan_file(shijian)'转换日期时间函数
s_month=month(shijian)
ifs_month<10thens_month="0"&s_month
s_day=day(shijian)
ifs_day<10thens_day="0"&s_day
s_hour=hour(shijian)
ifs_hour<10thens_hour="0"&s_hour
s_minute=minute(shijian)
ifs_minute<10thens_minute="0"&s_minute
s_ss=second(shijian)
ifs_ss<10thens_ss="0"&s_ss
chan_file=s_month&s_day&s_hour&s_minute&s_ss
endfunction
top="<html><head><title>news</title></head><body>"
botom="</body></html>"
msg=request.Form("msg")
msg=replace(msg,vbcrlf,"")
msg=replace(msg,chr(9),"")
msg=replace(msg,""," ")
msg=replace(msg,"\r\n","
")
msg=replace(msg,"\n","
")
msg=top&msg&botom
Setfs=Server.CreateObject("Scripting.FileSystemObject")
all_tree2=server.mappath("news")&"\"&chan_data(now)
if(fs.FolderExists(all_tree2))then'判断今天的文件夹是否存在
else
fs.CreateFolder(all_tree2)
endif
pass=chan_file(now)
randomize '使用系统计时器来初始化乱数产生器
pass=rnd(pass)
pass=get_pass(pass)
pass=left(pass,10)
file1=pass
files=file1&".txt"
filez=all_tree2&"\"&files
setts=fs.createtextfile(filez,true)'写文件
forz=1tolen(msg)
write_now=mid(msg,z,1)
ts.write(write_now)
next
'ts.writeline(all_msg)
ts.close
setts=nothing '文件生成
iferr.number<>0orerrthen%>
<scriptlanguage="javascript">
alert("不能完成")
</script>