Free Guestbook App| PowerASP.com providing a free version, we altered the code so we could use on our site. We've provide our code for FREE. Enjoy!! In the zip file there is an Access 2000 and Access 97 version database. Here is the code <% @language="vbscript" %> <% 'Dont Cache the page. response.expires = 0 response.expiresabsolute = Now() - 1 response.addHeader "pragma","no-cache" response.addHeader "cache-control","private" Response.CacheControl = "no-cache" %> <html> <head> <title>ASPFree.com Guestbook app</title> </head> <body> <% ACTION = Request.Form("ACTION") %> <% If ACTION = "Save" Then %> <!--#INCLUDE FILE="savemessage.asp"--> <% End If %>
<% If ACTION = "Save" Then %> <p align ="center"><font face="Arial">Thank You For Your Comments</font></p> <b> <% End If %>
<body bgcolor="#FFFFFF">
<form method="POST" action="default.asp"> <input type="hidden" name="ACTION" value="Save"><div align="center"><center><p><font face="Arial"><big><strong>Guest Book Entry</strong></big></font></p> </center></div><div align="center"><center><table border="0" bgcolor="#808080"> <tr> <td bgcolor="#800000"><strong><small><font color="#FFFFFF" face="Arial">NAME</font></small></strong></td> <td bgcolor="#C0C0C0"><input type="text" name="NAME" size="30"></td> </tr> <tr> <td bgcolor="#800000"><strong><small><font color="#FFFFFF" face="Arial">EMAIL</font></small></strong></td> <td bgcolor="#C0C0C0"><input type="text" name="EMAIL" size="30"></td> </tr> <tr> <td bgcolor="#800000"><strong><small><font color="#FFFFFF" face="Arial">HOMEPAGE URL</font></small></strong></td> <td bgcolor="#C0C0C0"><input type="text" name="URL" size="30" value="http://"></td> </tr> <tr> <td bgcolor="#800000"><strong><small><font color="#FFFFFF" face="Arial">MESSAGE</font></small></strong></td> <td bgcolor="#C0C0C0"><textarea rows="4" name="MESSAGE" cols="30"></textarea></td> </tr> </table> </center></div><div align="center"><center><p><input type="submit" value="Add To Guestbook"></p> </center></div> </form> <!--#include file="showmessages.asp"--> </body> </html>
*Save Messages Include file <!--#include file="conn.asp"--> <% NAME = Request.Form("NAME") MESSAGE = Request.Form("MESSAGE") EMAIL = Request.Form("EMAIL") URL = Request.Form("URL") IPAddy = request.servervariables("Remote_Addr") %> <% If URL = "http://" Then URL = "" End If %>
<% 'Declare all variables Dim conn Dim strDelSql Dim strSQL
'Open Connection to the database Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open strconn
'Delete any records that might contain Null data strDelSql = "DELETE FROM Guestbook WHERE (((Guestbook.Name)='') AND ((Guestbook.Email)='') AND ((Guestbook.Message)=''))" Conn.execute(strDelSql)
'Build Insert String strSQL = "INSERT INTO Guestbook(Name, Email, Date_Entered, URL, IP_Address, Message)" strSQL = strSQL & " SELECT " strSQL = strSQL & "'" & Name & "' as text1, " strSQL = strSQL & "'" & Email & "' as text2, " strSQL = strSQL & "'" & Date() & "' as text3, " strSql = strSQL & "'" & URL & "' as text4, " strSql = strsql & "'" & IPAddy & "' as text5, " strSQL = strSQL & "'" & replace(request("Message"), "'", "''") & "' as text6 " conn.execute(strsql) conn.close set conn = nothing %>
<% Sub TLdelaySec(DelaySeconds) SecCount = 0 Sec2 = 0 While SecCount < DelaySeconds + 1 Sec1 = Second(Time()) If Sec1 <> Sec2 Then Sec2 = Second(Time()) SecCount = SecCount + 1 End If Wend End Sub %>
<% TLdelaySec(4) %> Show Messages Include file--This part of the code is provided by PowerASP.com <!--#include file="conn.asp"--> <% ACTION = Request.Querystring("ACTION") %> <% PAGE = CInt(Request.Querystring("PAGE")) %>
<% RCOUNT = CInt(Request.Querystring("RCOUNT")) %> <% If RCOUNT = "" Then %> <% RCOUNT = "0" %> <% End If %>
<%
Dim CmdShowEntries Dim MySQL
'** Get initial recordset set conn = server.createobject("adodb.connection") conn.open strconn Set CmdShowEntries = Server.CreateObject("ADODB.Recordset") MySQL = "SELECT * FROM Guestbook WHERE (NOT (NAME IS NULL)) ORDER BY DATE_ENTERED DESC" CmdShowEntries.Open MySQL, conn, 3 %>
<% HOWMANY = 5 %>
<% '** Determine Page Size CmdShowEntries.PageSize = HOWMANY %>
<% If ACTION = "FORWARD" Then %> <% PAGE = PAGE + 1 %> <% RCOUNT = RCOUNT + HOWMANY %> <% For DACOUNT = 1 To RCOUNT %> <% CmdShowEntries.MoveNext %> <% Next %> <% End If %>
<% If ACTION = "BACK" Then %> <% PAGE = PAGE - 1 %> <% RCOUNT = RCOUNT - HOWMANY %> <% If RCOUNT <> 0 Then %> <% For DACOUNT = 1 To RCOUNT %> <% CmdShowEntries.MoveNext %> <% Next %> <% End If %> <% End If %>
<% If RCOUNT = "0" Then %> <% PAGE = 1 %> <p align="center"><font face="Arial">
<% If CmdShowEntries.RecordCount > 1 or CmdShowEntries.RecordCount = 0 Then %> <% =CmdShowEntries.RecordCount %> Messages Found <% Else %> <% =CmdShowEntries.RecordCount %> Message Found <% End If %> <br> <% If CmdShowEntries.RecordCount <> 0 And HOWMANY < CmdShowEntries.RecordCount Then %> Showing First <% = HOWMANY %> <% End If %> <br> </font></p> <% End If %>
<% If CmdShowEntries.RecordCount = 0 Then %> </BODY> </HTML> <% Response.End %> <% End If %>
<hr>
<div align="center"><center>
<table border="0" width="600">
<% y = 0 %> <% while NOT CmdShowEntries.EOF %>
<tr> <td bgcolor="#C0C0C0"><strong><font face="Arial"><%= CmdShowEntries("NAME") %></font></strong></td> <td bgcolor="#C0C0C0"><a href="mailto:<%= CmdShowEntries("EMAIL") %>"><font face="Arial"><%= CmdShowEntries("EMAIL") %></font></a></td> <td bgcolor="#C0C0C0"><font face="Arial"><a href="<%= CmdShowEntries("URL") %>" Target="_blank" ><%= CmdShowEntries("URL") %></a></font></td> </tr> <tr> <td bgcolor="#800000" colspan="3"><font color="#FFFFFF" face="Arial"><strong><%= CmdShowEntries("MESSAGE") %></strong></font></td> </tr> <tr> <td bgcolor="#C0C0C0" colspan="3"><strong><font face="Arial"><%= CmdShowEntries("DATE_ENTERED") %> IP ADDRESS <%= CmdShowEntries("IP_ADDRESS") %></font></strong></td> </tr> <tr> <td colspan="3" height="20"><strong><font face="Arial"> </font></strong></td> </tr>
<% CmdShowEntries.MoveNext %> <% y = y + 1 %> <% if y = HOWMANY then %> <% while NOT CmdShowEntries.EOF %> <% CmdShowEntries.MoveNext %> <% wend %> <% end if %> <% wend%>
</table> </center></div>
<br>
<div align="center"><center>
<table border="0" width="400"> <tr> <td width="200"><% If RCOUNT > 0 Then %> <form method="PUT" action="default.asp"> <input type="hidden" name="ACTION" value="BACK"> <input type="hidden" name="RCOUNT" value="<% =RCOUNT %>"> <input type="hidden" name="PAGE" value="<% =PAGE %>">
<p><font face="Arial"><input type="submit" value="Previous <% =HOWMANY %> Messages"></font></p> </form> <% End If %> </td>
<td width="200"><% If PAGE = CmdShowEntries.PageCount Then %> <% Else %> <form method="PUT" action="default.asp"> <input type="hidden" name="ACTION" value="FORWARD"> <input type="hidden" name="RCOUNT" value="<% =RCOUNT %>"> <input type="hidden" name="PAGE" value="<% =PAGE %>">
<p><font face="Arial"><input type="submit" value="More Messages"></font></p> </form> <% End If %> </td> </tr> </table> </center></div> |
|
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More ASP Code Articles More By aspfree developerWorks - FREE Tools! | This demonstration gives you an overview of IBM® Rational® Build Forge Express Edition, a global offering that provides a framework to automate and execute software processes. Rational Build Forge provides a software assembly line that can support all of your tools, technologies, and platforms so you can achieve a repeatable, reliable, and traceable build and release process. FREE! Go There Now!
| | | | Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools. FREE! Go There Now!
| | | | Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right." FREE! Go There Now!
| | | | Learn to enable users to both rate existing animations and to combine existing animations into new snippets. This is the third in a series of three tutorials that chronicle the building of a site that enables collaborative discussion and animation building using Domino and OpenLaszlo. FREE! Go There Now!
| | | | This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product. FREE! Go There Now!
| | | | Secure your Web applications with IBM Rational AppScan Standard Edition V7.7, previously known as Watchfire AppScan. This Web application security testing tool automates vulnerability assessments and scans and tests for common Web application vulnerabilities. Visit IBM developerWorks to download a free trial of IBM Rational AppScan Standard Edition V7.7. FREE! Go There Now!
| | | | Learn how to implement a build management system that uses and extends your existing automation technologies. This tutorial shows, step-by-step, how to install and configure IBM Rational Build Forge to manage builds for Jakarta Tomcat from source code. FREE! Go There Now!
| | | | Discover how Rational tools and best practices for testing can make your job easier. The new Rational Testing eKits provide you with valuable resources – including demos, webcasts, tutorials, and articles – that help you address your specific testing needs across the software lifecycle. Five new eKits are available covering the topics of Requirements and Test Management, Functional Testing, Performance Testing, Code Quality and Embedded Systems, and SOA and Web Services Testing. FREE! Go There Now!
| | | | Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads. FREE! Go There Now!
| | | | In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |