Gastenboek(met smilies)(zonder admin)
Auteur: J.Z.N./WebPaulsky - 21 december 2004 - 18:51 - Gekeurd door: Dennisvb - Hits: 4107 - Aantal punten: 4.50 (3 stemmen)
Lees alles hieronder,
Veel plezier ermee
|
Code: |
**schrijven.asp**
<html>
<head>
<title>Berichten versturen</title>
</head>
<body>
<form action="defSchrijven.asp" name="Forumulier1" id="Forumulier1" method="post">
<table width="600" height="30">
<td width="327"> <a href="index.asp">Gastenboek Home</a> - <a href="schrijven.asp">Bericht
Schrijven</a> - <A href="mailto:vis@websitenet.nl">Contact</A></td>
</table>
<table width="30%" border="0">
<tr>
<td width="27%">Naam*:</td>
<td width="73%"><input name="Naam" type="text" id="Naam"></td>
</tr>
<tr>
<td>E-mail*:</td>
<td><input name="E-mail" type="text" id="E-mail"></td>
</tr>
<tr>
<td>Bericht:</td>
<td><textarea name="textarea" cols="40" rows="4"></textarea>
</td>
</tr>
<tr>
<td colspan="2"><div align="right">
<input name="Wis invoer" type="reset" id="Wis invoer" value="Wis invoer">
<input name="Verstuur" type="submit" id="Verstuur" value="Verstuur">
</div></td>
</tr>
</table>
<br>
<font color="#FF0000">Velden met een * erachter zijn verplicht</font>
<br>
:buig <img src="images/worshippy.gif"> | :P <img src="images/tongue.gif"> | :) <img src="images/smile1.gif"> | :nerd <img src="images/nerd.gif"> | :mond <img src="images/mond.gif"> | :@ <img src="images/mad.gif"> | :lijst <img src="images/lijstje.gif""> | :king <img src="images/koning.gif"> | ;) <img src="images/knipoog.gif"> | :heilig <img src="images/hypo.gif"> | :evil <img src="images/evil.gif"> | :cry <img src="images/cry.gif"> | :8 <img src="images/cool.gif"> | :cheer <img src="images/cheer.gif"> | :# <img src="images/bloos.gif""> | :bigg <img src="images/biggrin.gif"> | :bier <img src="images/bier.gif">
<br>© by <A href="http://webpaulsky.flance-hosting.com" target="_blank">WebPaulsky's
Webscript's</a>
</form>
</body>
</html>
<html> <head> <title>Berichten versturen</title> </head> <body> <form action="defSchrijven.asp" name="Forumulier1" id="Forumulier1" method="post"> <table width="600" height="30"> <td width="327"> <a href="index.asp">Gastenboek Home</a> - <a href="schrijven.asp">Bericht Schrijven</a> - <A href="mailto:vis@websitenet.nl">Contact</A></td> </table> <table width="30%" border="0"> <tr> <td width="27%">Naam*:</td> <td width="73%"><input name="Naam" type="text" id="Naam"></td> </tr> <tr> <td><input name="E-mail" type="text" id="E-mail"></td> </tr> <tr> <td>Bericht:</td> <td><textarea name="textarea" cols="40" rows="4"></textarea> </td> </tr> <tr> <td colspan="2"><div align="right"> <input name="Wis invoer" type="reset" id="Wis invoer" value="Wis invoer"> <input name="Verstuur" type="submit" id="Verstuur" value="Verstuur"> </div></td> </tr> </table> <br> <font color="#FF0000">Velden met een * erachter zijn verplicht</font> <br> :buig <img src="images/worshippy.gif"> | :P <img src="images/tongue.gif"> | :) <img src="images/smile1.gif"> | :nerd <img src="images/nerd.gif"> | :mond <img src="images/mond.gif"> | :@ <img src="images/mad.gif"> | :lijst <img src="images/lijstje.gif""> | :king <img src="images/koning.gif"> | ;) <img src="images/knipoog.gif"> | :heilig <img src="images/hypo.gif"> | :evil <img src="images/evil.gif"> | :cry <img src="images/cry.gif"> | :8 <img src="images/cool.gif"> | :cheer <img src="images/cheer.gif"> | :# <img src="images/bloos.gif""> | :bigg <img src="images/biggrin.gif"> | :bier <img src="images/bier.gif"> <br>© by <A href="http://webpaulsky.flance-hosting.com" target="_blank">WebPaulsky's Webscript's</a> </form> </body> </html>
**INDEX.ASP**
<%
function addSmileys(strBericht)
strBericht = replace(strBericht, ":buig", "<img src=""images/worshippy.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":P", "<img src=""images/tongue.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":)", "<img src=""images/smile1.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":nerd", "<img src=""images/nerd.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":mond", "<img src=""images/mond.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":@", "<img src=""images/mad.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":lijst", "<img src=""images/lijstje.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":king", "<img src=""images/koning.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ";)", "<img src=""images/knipoog.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":heilig", "<img src=""images/hypo.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":evil", "<img src=""images/evil.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":cry", "<img src=""images/cry.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":8", "<img src=""images/cool.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":cheer", "<img src=""images/cheer.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":#", "<img src=""images/bloos.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":bigg", "<img src=""images/biggrin.gif"">", 1, -1, 1)
strBericht = replace(strBericht, ":bier", "<img src=""images/bier.gif"">", 1, -1, 1)
addSmileys = strBericht
end function
%>
<html>
<head>
<title>Berichten bekijken</title>
</head>
<body>
<form>
<table width="400" height="30">
<td width="392">
<a href="index.asp">Gastenboek Home</a> - <a href="schrijven.asp">Bericht Schrijven</a> - <a href="mailto:vis@websitenet.nl">Contact</A>
</td>
</table>
<table width="401" height="121">
<td width="393" valign="top"><%
'Variabelen toekennen
Dim adoCon 'Dit doet de Connectie met de Database
Dim rsGuestbook 'Dit doet de records uit de database halen
Dim strSQL 'En dit doet hoe je de recrods uit de database wilt halen
'Hier maken we een ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Nou, hier zetten we een DSN-less connectie op met de pad van de database
adoCon.ConnectionString="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="&Server.MapPath("gastenboek.mdb") &";Persist Security Info=False"
adoCon.Open
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
'Recordset openen
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'De variablelen van de SQL openen. En de tabbelen uit de database
strSQL = "SELECT gastenboek.naam, gastenboek.email, gastenboek.bericht FROM gastenboek;"
'Alle troep openen
rsGuestbook.Open strSQL, adoCon
'En steeds overnieuw beginnen
Do While not rsGuestbook.EOF
'En dan alles opschrijven op de HTML pagina
Response.Write ("<br>")
Response.Write (rsGuestbook("Naam"))
Response.Write ("<br>")
Response.Write (rsGuestbook("Email"))
Response.Write ("<br>")
Response.Write (addSmileys(rsGuestbook("Bericht")))
Response.Write ("<hr>")
'En ga naar de volgende record
rsGuestbook.MoveNext
Loop
'En alle troep sluiten
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%></td>
</table>
© by <A href="http://webpaulsky.flance-hosting.com" target="_blank">WebPaulsky's Webscript's</a>
</form>
</body>
</html>
<% function addSmileys(strBericht) strBericht = replace(strBericht, ":buig", "<img src=""images/worshippy.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":P", "<img src=""images/tongue.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":)", "<img src=""images/smile1.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":nerd", "<img src=""images/nerd.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":mond", "<img src=""images/mond.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":@", "<img src=""images/mad.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":lijst", "<img src=""images/lijstje.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":king", "<img src=""images/koning.gif"">", 1, -1, 1) strBericht = replace(strBericht, ";)", "<img src=""images/knipoog.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":heilig", "<img src=""images/hypo.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":evil", "<img src=""images/evil.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":cry", "<img src=""images/cry.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":8", "<img src=""images/cool.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":cheer", "<img src=""images/cheer.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":#", "<img src=""images/bloos.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":bigg", "<img src=""images/biggrin.gif"">", 1, -1, 1) strBericht = replace(strBericht, ":bier", "<img src=""images/bier.gif"">", 1, -1, 1) addSmileys = strBericht %> <html> <head> <title>Berichten bekijken</title> </head> <body> <form> <table width="400" height="30"> <td width="392"> <a href="index.asp">Gastenboek Home</a> - <a href="schrijven.asp">Bericht Schrijven</a> - <a href="mailto:vis@websitenet.nl">Contact</A> </td> </table> <table width="401" height="121"> <td width="393" valign="top"><% 'Variabelen toekennen Dim adoCon 'Dit doet de Connectie met de Database Dim rsGuestbook 'Dit doet de records uit de database halen Dim strSQL 'En dit doet hoe je de recrods uit de database wilt halen 'Hier maken we een ADO connection odject Set adoCon = Server.CreateObject("ADODB.Connection") 'Nou, hier zetten we een DSN-less connectie op met de pad van de database adoCon.ConnectionString="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="&Server.MapPath("gastenboek.mdb") &";Persist Security Info=False" adoCon.Open 'Set an active connection to the Connection object using DSN connection 'adoCon.Open "DSN=guestbook" 'Recordset openen Set rsGuestbook = Server.CreateObject("ADODB.Recordset") 'De variablelen van de SQL openen. En de tabbelen uit de database strSQL = "SELECT gastenboek.naam, gastenboek.email, gastenboek.bericht FROM gastenboek;" 'Alle troep openen rsGuestbook.Open strSQL, adoCon 'En steeds overnieuw beginnen Do While not rsGuestbook.EOF 'En dan alles opschrijven op de HTML pagina Response.Write ("<br>") Response.Write (rsGuestbook("Naam")) Response.Write ("<br>") Response.Write (rsGuestbook("Email")) Response.Write ("<br>") Response.Write (addSmileys(rsGuestbook("Bericht"))) Response.Write ("<hr>") 'En ga naar de volgende record rsGuestbook.MoveNext Loop 'En alle troep sluiten rsGuestbook.Close Set rsGuestbook = Nothing Set adoCon = Nothing %></td> </table> © by <A href="http://webpaulsky.flance-hosting.com" target="_blank">WebPaulsky's Webscript's</a> </form> </body> </html>
**defSchrijven.asp**
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsAddComments 'Holds the recordset for the new record to be added to the database
Dim strSQL 'Holds the SQL query for the database
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("gastenboek.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
'Create an ADO recordset object
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT gastenboek.naam, gastenboek.email, gastenboek.bericht FROM gastenboek;"
'Set the cursor type we are using so we can navigate through the recordset
rsAddComments.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsAddComments.LockType = 3
'Open the tblComments table using the SQL query held in the strSQL varaiable
rsAddComments.Open strSQL, adoCon
'Tell the recordset we are adding a new record to it
rsAddComments.AddNew
'Add a new record to the recordset
rsAddComments.Fields("naam") = Request.Form("Naam")
rsAddComments.Fields("email") = Request.Form("E-mail")
rsAddComments.Fields("bericht") = Request.Form("textarea")
'Write the updated recordset to the database
rsAddComments.Update
'Reset server objects
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
'Redirect to the guestbook.asp page
Response.Redirect "index.asp"
%>
<% 'Dimension variables Dim adoCon 'Holds the Database Connection Object Dim rsAddComments 'Holds the recordset for the new record to be added to the database Dim strSQL 'Holds the SQL query for the database 'Create an ADO connection odject Set adoCon = Server.CreateObject("ADODB.Connection") 'Set an active connection to the Connection object using a DSN-less connection adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("gastenboek.mdb") 'Set an active connection to the Connection object using DSN connection 'adoCon.Open "DSN=guestbook" 'Create an ADO recordset object Set rsAddComments = Server.CreateObject("ADODB.Recordset") 'Initialise the strSQL variable with an SQL statement to query the database strSQL = "SELECT gastenboek.naam, gastenboek.email, gastenboek.bericht FROM gastenboek;" 'Set the cursor type we are using so we can navigate through the recordset rsAddComments.CursorType = 2 'Set the lock type so that the record is locked by ADO when it is updated rsAddComments.LockType = 3 'Open the tblComments table using the SQL query held in the strSQL varaiable rsAddComments.Open strSQL, adoCon 'Tell the recordset we are adding a new record to it rsAddComments.AddNew 'Add a new record to the recordset rsAddComments.Fields("naam") = Request.Form("Naam") rsAddComments.Fields("email") = Request.Form("E-mail") rsAddComments.Fields("bericht") = Request.Form("textarea") 'Write the updated recordset to the database rsAddComments.Update 'Reset server objects rsAddComments.Close Set rsAddComments = Nothing Set adoCon = Nothing 'Redirect to the guestbook.asp page Response.Redirect "index.asp" %>
Verander het email adres even in de index en schrijf pagina en laat de copyirght staan staat de copyirght erniet ?? dan verleen ik geen hulp
Download de database hier
http://i.domaindlx.com/test99/gastenboek.mdb zelf even leeg maken
Demo:
hierzo Download code (.txt)
|
|
|
Stemmen |
Niet ingelogd. |
|