HTML files generated using ASP
'Two Home Pages is index.htm. Relatively simple procedures, mainly used in the file operations ASP objects.
<! - Index. Htm ——————————————- ————————————>
<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN"
"Http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Untitled Document </ title>
<meta Http-equiv="Content-Type" content="text/html; charset=gb2312">
</ Head>
<body>
<table Width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> <form Name="form1" method="post" action="send.asp">
<table Width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCFFFF">
<tr>
<td Height="20"> <div align="center"> Send message </ div> </ td>
</ Tr>
<tr>
<td> <div Align="center">
<textarea Name="msg" cols="100" rows="6"> </ textarea>
</ Div> </ td>
</ Tr>
<tr>
<td> <div Align="center">
<input Type="submit" name="Submit" value="Submit">
<input Type="reset" name="Submit2" value="Reset">
</ Div> </ td>
</ Tr>
</ Table>
</ Form> </ td>
</ Tr>
</ Table>
</ Body>
</ Html>
'/ / Send.asp
<%
Function chan_time (shijian) 'conversion date and time functions
S_year = year (shijian)
If len (s_year) = 2 then s_year = "20" & s_year
S_month = month (shijian)
If s_month <10 then s_month = "0" & s_month
S_day = day (shijian)
If s_day <10 then s_day = "0" & s_day
S_hour = hour (shijian)
If s_hour <10 then s_hour = "0" & s_hour
S_minute = minute (shijian)
If s_minute <10 then s_minute = "0" & s_minute
Chan_time = s_year & s_month s_day & & & s_minute s_hour
End function
Function chan_data (shijian) 'conversion date and time functions
S_year = year (shijian)
If len (s_year) = 2 then s_year = "20" & s_year
S_month = month (shijian)
If s_month <10 then s_month = "0" & s_month
S_day = day (shijian)
If s_day <10 then s_day = "0" & s_day
Chan_data = s_year & s_month & s_day
End function
Function chan_file (shijian) 'conversion date and time functions
S_month = month (shijian)
If s_month <10 then s_month = "0" & s_month
S_day = day (shijian)
If s_day <10 then s_day = "0" & s_day
S_hour = hour (shijian)
If s_hour <10 then s_hour = "0" & s_hour
S_minute = minute (shijian)
If s_minute <10 then s_minute = "0" & s_minute
S_ss = second (shijian)
If s_ss <10 then s_ss = "0" & s_ss
Chan_file = s_month & s_day s_hour & & & s_ss s_minute
End function
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", "<br>")
Msg = replace (msg, "\ n", "<br>")
Msg = msg & & top botom
Set fs = Server.CreateObject ( "Scripting.FileSystemObject")
All_tree2 = server.mappath ( "news") & "\" & chan_data (now)
If (fs.FolderExists (all_tree2)) then 'judgement today, the existence of the folder
Else
Fs.CreateFolder (all_tree2)
End if
Pass = chan_file (now)
Randomize 'using the system to initialize the timer Random Number Generator
Pass = rnd (pass)
Pass = get_pass (pass)
Pass = left (pass, 10)
File1 = pass
File1 = & files. "Txt"
Filez all_tree2 & = "\" & files
Fs.createtextfile set ts = (filez, true) 'written document
For z = 1 to len (msg)
Write_now mid = (msg, z, 1)
Ts.write (write_now)
Next
'Ts.writeline (all_msg)
Ts.close
Nothing set ts = 'document generation
If err.number <> 0 or err then%>
<script Language="javascript">
Alert ( "can not be completed")
</ Script>
<% Else%>
<script Language="javascript">
Alert ( "completed")
History.back ();
</ Script>
<% End if
Set MyFile = fs.GetFile (filez)
All_tree2 = server.mappath ( "news") & "\" & chan_data (now)
If (fs.FolderExists (all_tree2)) then
Else
Fs.CreateFolder (all_tree2)
End if
MyFile.name = left (MyFile.name, len (MyFile.name) -4) &. "Htm"
Set MyFile = nothing
Set fs = nothing
Set fdir = nothing
Function get_pass (pass)
Pass = cstr (pass)
Pass = replace (pass, "","")
Pass = replace (pass, "","")
Pass = replace (pass ,"-","")
Pass = replace (pass, "","")
Pass = replace (pass ,":","")
Pass = replace (pass ,".","")
Pass = replace (pass ,"+","")
Pass = replace (pass ,"_","")
Pass = replace (pass ,"<","")
Pass = replace (pass ,">","")
Pass = replace (pass ,"!","")
Pass = replace (pass ,"@","")
Pass = replace (pass ,"#","")
Pass = replace (pass ,"$","")
Pass = replace (pass ,"%","")
Pass = replace (pass ,"^","")
Pass = replace (pass ,"&","")
Pass = replace (pass ,"*","")
Pass = replace (pass ,"(","")
Pass = replace (pass ,")","")
Pass = replace (pass ,"=","")
Pass = replace (pass, "\ ","")
Pass = replace (pass ,"/","")
Pass = replace (pass ,"|","")
Get_pass pass =
End function
%>
'/ /
Send.asp index.htm to put you and the ASP directory, and then build a news folder. Open the browser, in the address box and type: http:// your machine name / ASP your virtual directory name / index.html enter text and then submit, OK! ASP directory you look at the news in the new folder is not more new folders, and are named after the current date. You just inside the text, and see if it is not generating the HTML document. How like you can on the basis of this press release to be a simple system. .
Tags: ASP








0 Comments to “HTML files generated using ASP”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.