|
<p><strong>使用ASP生成HTML文件</strong></p><hr/><p><!--index.htm--></p><p><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"<br/>"http://www.w3.org/TR/html4/loose.dtd"><br/><html><br/><head><br/><title>Untitled Document</title><br/><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><br/></head></p><p><body><br/><table width="770" border="0" align="center" cellpadding="0" cellspacing="0"><br/><tr><br/><td><form name="form1" method="post" action="send.asp"><br/><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCFFFF"><br/><tr><br/><td height="20"><div align="center">发送消息</div></td><br/></tr><br/><tr><br/><td><div align="center"><br/><textarea name="msg" cols="100" rows="6"></textarea><br/></div></td><br/></tr><br/><tr><br/><td><div align="center"><br/><input type="submit" name="Submit" value="Submit"><br/><input type="reset" name="Submit2" value="Reset"><br/></div></td><br/></tr><br/></table><br/></form></td><br/></tr><br/></table><br/></body><br/></html><br/>'//send.asp</p><hr/><p><%<br/>function chan_time(shijian)'转换日期时间函数<br/>s_year=year(shijian)<br/>if len(s_year)=2 then s_year="20"&s_year<br/>s_month=month(shijian)<br/>if s_month<10 then s_month="0"&s_month<br/>s_day=day(shijian)<br/>if s_day<10 then s_day="0"&s_day<br/>s_hour=hour(shijian)<br/>if s_hour<10 then s_hour="0"&s_hour<br/>s_minute=minute(shijian)<br/>if s_minute<10 then s_minute="0"&s_minute<br/>chan_time=s_year & s_month & s_day & s_hour & s_minute<br/>end function</p><p>function chan_data(shijian) '转换日期时间函数<br/>s_year=year(shijian)<br/>if len(s_year)=2 then s_year="20"&s_year<br/>s_month=month(shijian)<br/>if s_month<10 then s_month="0"&s_month<br/>s_day=day(shijian)<br/>if s_day<10 then s_day="0"&s_day<br/>chan_data=s_year & s_month & s_day<br/>end function</p><p>function chan_file(shijian)'转换日期时间函数<br/>s_month=month(shijian)<br/>if s_month<10 then s_month="0"&s_month<br/>s_day=day(shijian)<br/>if s_day<10 then s_day="0"&s_day<br/>s_hour=hour(shijian)<br/>if s_hour<10 then s_hour="0"&s_hour<br/>s_minute=minute(shijian)<br/>if s_minute<10 then s_minute="0"&s_minute<br/>s_ss=second(shijian)<br/>if s_ss<10 then s_ss="0"&s_ss<br/>chan_file = s_month & s_day & s_hour & s_minute & s_ss<br/>end function<br/>top="<html><head><title>news</title></head><body>"<br/>botom="</body></html>"<br/>msg=request.Form("msg")<br/>msg=replace(msg,vbcrlf,"")<br/>msg=replace(msg,chr(9),"") <br/>msg=replace(msg," ","&nbsp;")<br/>msg=replace(msg,"\r\n","<br>")<br/>msg=replace(msg,"\n","<br>")<br/>msg=top&msg&botom<br/>Set fs=Server.CreateObject("Scripting.FileSystemObject")<br/>all_tree2=server.mappath("news")&"\"&chan_data(now)<br/>if (fs.FolderExists(all_tree2)) then'判断今天的文件夹是否存在<br/>else<br/>fs.CreateFolder(all_tree2)<br/>end if <br/>pass=chan_file(now)<br/>randomize '使用系统计时器来初始化乱数产生器<br/>pass=rnd(pass)<br/>pass=get_pass(pass)<br/>pass=left(pass,10)</p><hr/><br/>file1=pass<br/>files=file1&".txt"<br/>filez=all_tree2&"\"&files <p>set ts = fs.createtextfile(filez,true) '写文件<br/>for z=1 to len(msg)<br/>write_now=mid(msg,z,1)<br/>ts.write(write_now)<br/>next<br/>' ts.writeline(all_msg)<br/>ts.close<br/>set ts=nothing '文件生成</p><p>if err.number<>0 or err then%><br/><script language="javascript"><br/>alert("不能完成")<br/></script><br/><%else%><br/><script language="javascript"><br/>alert("已完成")<br/>history.back();<br/></script><br/><%end if<br/>Set MyFile = fs.GetFile(filez) <br/>all_tree2=server.mappath("news")&"\"&chan_data(now)<br/>if (fs.FolderExists(all_tree2)) then<br/>else<br/>fs.CreateFolder(all_tree2)<br/>end if <br/>MyFile.name= left(MyFile.name,len(MyFile.name)-4)&".htm" <br/>set MyFile=nothing <br/>set fs=nothing<br/>set fdir=nothing<br/>function get_pass(pass)</p><p>pass=cstr(pass)<br/>pass=replace(pass," ","")<br/>pass=replace(pass," ","")<br/>pass=replace(pass,"-","")<br/>pass=replace(pass," ","")<br/>pass=replace(pass,":","")<br/>pass=replace(pass,".","")<br/>pass=replace(pass,"+","")<br/>pass=replace(pass,"_","")<br/>pass=replace(pass,"<","")<br/>pass=replace(pass,">","")<br/>pass=replace(pass,"!","")<br/>pass=replace(pass,"@","")<br/>pass=replace(pass,"#","")<br/>pass=replace(pass,"$","")<br/>pass=replace(pass,"%","")<br/>pass=replace(pass,"^","")<br/>pass=replace(pass,"&","")<br/>pass=replace(pass,"*","")<br/>pass=replace(pass,"(","")<br/>pass=replace(pass,")","")<br/>pass=replace(pass,"=","")<br/>pass=replace(pass,"\","")<br/>pass=replace(pass,"/","")<br/>pass=replace(pass,"|","")<br/>get_pass=pass</p> |
|