
Trabajaba con dos archivos un TXT y un ASP
ejemplo.asp
--------------------------
Código:
ejemplo.txt <% @LANGUAGE="VBSCRIPT"%> <% Dim CONST_LIBRO, oFSO, f, archivo, accion, contenido CONST_LIBRO="ejemplo.txt" set oFSO=Server.CreateObject("Scripting.FileSystemObject") accion=Trim (CStr(Request.QueryString("a"))) select case accion case "guardar" Guardar MostrarLibro MostrarFormulario case else MostrarLibro MostrarFormulario end select set oFSO=nothing Sub MostrarLibro set archivo=oFSO.GetFile( Server.MapPath(CONST_LIBRO) ) set f=archivo.OpenAsTextStream contenido=f.ReadAll f.Close set f=nothing set archivo=nothing Response.Write(contenido) End Sub 'MostrarLibro Sub Guardar Dim nombre, mail, mensaje, fecha, archivo, f fecha=Day(Now())&"/"&Month(Now())&"/"&Year(Now())&" a las "&Hour(Now())&":"&Minute(Now())&"."&Second(Now()) nombre=Trim(CStr(Request.Form("nombre"))) mail=CStr(Request.Form("mail")) mensaje=CStr(Request.Form("mensaje")) ip=CStr(Request.servervariables("remote_host")) ' No queremos comentarios anónimos o vacíos :-) if nombre <> "" and mensaje <>"" then set archivo=oFSO.GetFile( Server.MapPath(CONST_LIBRO) ) 'Abro el archivo como un flujo de texto; 8: ForAppending, añadimos al final set f=archivo.OpenAsTextStream(8) f.WriteLine("<hr noshade>") f.WriteLine("<b>"&nombre&" ("&mail&")</b> escribió el "&fecha&":<br>") f.WriteLine(mensaje) f.WriteLine("<br><br>") f.WriteLine("mensaje: "&ip&"") 'Cierro el fichero f.Close set f=nothing set archivo=nothing Response.Write("<small>Se ha añadido con éxito tu comentario</small>") end if End Sub 'Guardar Sub MostrarFormulario %> <html> <head> <style> <!-- BODY{ scrollbar-face-color:#333333; scrollbar-arrow-color:#007DAA; scrollbar-track-color:#000000; scrollbar-shadow-color:#007DAA; scrollbar-highlight-color:#FFFFFF; scrollbar-3dlight-color:#28BEEB; scrollbar-darkshadow-Color:#363636; background-attachment: fixed; background-repeat: repeat; background-position: 0 0; } --> </style> </head> <body> <hr size="2"> <table BORDER="0" ALIGN="center"> <tr> <td><form NAME="Libro" METHOD="post" ACTION="ejemplo.asp?a=guardar"> </td> </tr> <tr> <td>Tu nombre:</td> <td><input TYPE="text" style="width: 170px; height: 25px; background-image: url('forml.JPG');font-family: Arial, Verdana; font-size: 8pt; font-weight: bold; color: rgb(255,255,255); border: 1px solid #28BEEB;" NAME="nombre" size="20"></td> </tr> <tr> <td>E-mail:</td> <td><input TYPE="text" style="width: 170px; height: 25px; background-image: url('forml.JPG');font-family: Arial, Verdana; font-size: 8pt; font-weight: bold; color: rgb(255,255,255); border: 1px solid #28BEEB;" NAME="mail" size="20"></td> </tr> <tr> <td>Mensaje:</td> <td><textarea ROWS="5" COLS="30" style="width: 270px; height: 100px; background-color: rgb(128,128,128); font-family: Arial, Verdana; font-size: 8pt; font-weight: bold; color: rgb(255,255,255); border: 1px solid #28BEEB;" WRAP="virtual" NAME="mensaje"></textarea></td> </tr> <tr> <td COLSPAN="2"><p align="center"><input TYPE="submit" VALUE="Escribir"><input TYPE="reset" VALUE="Limpiar"> </td> </tr> </table> </form> </body> </html> <% End Sub 'MostrarFormulario %>
----------------------------
Código:
gracias! <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>- Message Board -</title> <style> <!-- BODY{ td { ; font-family: Arial ; font-size: 10pt; color: #FFFFFF } p { ; font-family: Arial ; font-size: 10pt; color: #FFFFFF } a { font-family: Arial ; font-size: 10pt; color: #FFFFFF } scrollbar-face-color:#333333; scrollbar-arrow-color:#007DAA; scrollbar-track-color:#000000; scrollbar-shadow-color:#007DAA; scrollbar-highlight-color:#FFFFFF; scrollbar-3dlight-color:#28BEEB; scrollbar-darkshadow-Color:#363636; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> </head> <body bgcolor="#000000" background="Pics/board.JPG"> <center> <font color="#28BEEB"><i><b>Bienvenido a nuestro Board, dejanos tu mensaje,<br>completando el formulario al final de esta página</b></i> </center></font> <hr noshade> <hr noshade> <b> Augusto ([email protected])</b> escribió el 29/9/2003:<br> Aca pueden dejar su firma! :-) <br><br> mensaje: 216.232.34.32
