tieni! modificalo secondo le tue esigenze.
codice:
<%
Const bDeleteEntries = True
Dim bForce
bForce = Request.QueryString("force")
Dim strFile ' String variable to store the path / file we write to
strFile = Server.MapPath("guestbook.txt")
If Request.Form.Count = 0 Then
' Display the entry form.
%>
<h3>Sign Our Guestbook:</h3>
<form action="guestbook.asp" method="post">
<table>
<tr>
<th align="right">Name:</td>
<td><input type="text" name="name" size="15"></input></td>
</tr>
<tr>
<th align="right">Comment:</td>
<td><input type="text" name="comment" size="35"></input></td>
</tr>
</table>
<input type="submit" value="Sign Guestbook!"></input>
</form>
<h3>Today's Comments:</h3>
<!-- Instead of doing this in script, I simply include
the guestbook file as is -->
<%
Else
Dim objFSO 'FileSystemObject Variable
Dim objFile 'File Object Variable
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFile, 8, True)
objFile.Write ""
objFile.Write Server.HTMLEncode(Request.Form("name"))
objFile.Write ": "
objFile.Write Server.HTMLEncode(Request.Form("comment"))
objFile.Write "
"
objFile.WriteLine ""
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
%>
<H3>Your comments have been written to the file!</H3>
Back to the guestbook
<%
End If
If bDeleteEntries Then
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strFile)
If DateDiff("d", objFile.DateLastModified, Date()) <> 0 Or bForce <> "" Then
Set objFile = Nothing
Set objFile = objFSO.CreateTextFile(strFile, True)
objFile.Write "John: "
objFile.WriteLine "I hope you like our guestbook!
"
objFile.Close
End If
Set objFile = Nothing
Set objFSO = Nothing
End If
%>