Smileys i tagwall *HASTER*
Hvor i denne kode skal jeg indsætte :<% =replace(rs(\"tekst\"), \":-)\", \"<img src=\'smil.jpg\'>\") %>
eller :
<% replace(rs(\"tekst\"), \":-)\", \"<img src=\"\"smilie.gif\"\" alt=\"\"glad\"\">\")
replace(rs(\"tekst\"), \":-(\", \"<img src=\"\"smilie2.gif\"\" alt=\"\"sur\"\">\")
%>
<% Response.Buffer = \"True\" %>
<% mode = request(\"mode\")%>
<head>
<title>Gæstebog</title>
<style>
<!--
a:link {color:#000000; text-decoration:none}
a:visited {color:#000000; text-decoration:none}
a:hover {color:#000000; text-decoration:underline}
-->
</style>
</head>
<%
if mode = \"write\" then
nickname = Trim(Request.Form(\"nickname\"))
message = Trim(Request.Form(\"message\"))
if nickname = \"\" then
error = \"[ Du skal skrive et nickname ]\"
end if
if message = \"\" then
error = \"[ Du SKAL skrive en besked ]\"
end if
if not write = \"nej\" then
if message = \"\" then
else
write = \"yes\"
end if
end if
if write = \"yes\" then
Const adOpenKeyset = 1
Const adLockOptimistic = 3
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\" & Server.MapPath(\"access.mdb\") & \";UID=;PWD=;\"
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"Select * From messages\"
rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
rs.AddNew
rs(\"nickname\") = Request.form(\"nickname\")
rs(\"message\") = Request.form(\"message\")
rs(\"fontcolor\") = Request.form(\"fontcolor\")
rs(\"fontface\") = Request.form(\"fontface\")
rs(\"ip\") = request.servervariables(\"remote_Addr\")
rs(\"time\") = time
rs.Update
rs.Close
Set rs = Nothing
Conn.Close
set Conn = Nothing
Response.Redirect(\"default.asp\")
end if
end if
%>
<body bgcolor=\"#9CA8B4\">
<div align=\"center\">
<center>
<table border=\"0\" width=\"600\" cellspacing=\"0\" bgcolor=\"#919191\" cellpadding=\"0\">
<tr>
<td width=\"100%\" style=\"border-style: solid; border-width: 1\" bordercolor=\"#000000\" bgcolor=\"#808080\">
<p align=\"center\"><font size=\"1\" face=\"Verdana\" color=\"#EEEEEE\"><b>Gæstebog
</b></font></p>
</td>
</tr>
<form action=\"default.asp?mode=write\" method=\"POST\" onsubmit=\"return FrontPage_Form1_Validator(this)\" name=\"FrontPage_Form1\">
<tr>
<td width=\"100%\" style=\"border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-bottom-style: solid; border-bottom-width: 1\" bordercolor=\"#000000\"><table border=\"0\"
cellspacing=\"0\" width=\"100%\" height=\"1\" cellpadding=\"0\">
<tr>
<td width=\"100%\" height=\"1\" bordercolor=\"#000000\">
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" height=\"85\" bgcolor=\"#919191\">
<tr>
<td width=\"300\" height=\"18\" colspan=\"2\">
<p align=\"left\"></p>
</td>
</tr>
<center>
<tr>
<td width=\"70\" height=\"25\">
<p align=\"center\"><font face=\"Verdana\" size=\"1\" color=\"#000000\">NickName:</font></td>
<td width=\"371\" height=\"25\"><font face=\"Verdana\" size=\"2\" color=\"#000000\"><INPUT TYPE=\"text\" NAME=\"nickname\" class=\"css\" size=\"16\" style=\"background-color: #9CA8B4; color: #000000; font-family: Verdana; font-size: 8 pt; border: 1 solid #000000\" maxlength=\"30\"></font></td>
</tr>
<tr>
<td width=\"80\" height=\"25\">
<p align=\"center\"><font face=\"Verdana\" size=\"1\" color=\"#000000\">Besked:</font></td>
<td width=\"371\" height=\"25\"><font face=\"Verdana\" size=\"2\" color=\"#000000\">
<INPUT TYPE=\"text\" NAME=\"message\" class=\"css\" size=\"59\" style=\"background-color: #9CA8B4; color: #000000; font-family: Verdana; font-size: 8 pt; border: 1 solid #000000\" maxlength=\"250\"></font></td>
</tr>
<tr>
<td width=\"80\" height=\"27\">
<p align=\"center\"><font face=\"Verdana\" size=\"1\" color=\"#000000\">Color,
Font:</font></td>
<td width=\"3\" height=\"27\">
<table border=\"0\" width=\"106%\" cellspacing=\"0\" cellpadding=\"0\" height=\"25\">
<tr>
<td width=\"100%\" align=\"left\" height=\"25\">
<p align=\"left\"><font face=\"Verdana\" size=\"1\" color=\"#000000\"><select name=\"fontcolor\" style=\"font-size: 8 pt; color: #000000; font-family: Verdana; background-color: #9CA8B4; border: 1px solid #000000\" tabIndex=\"4\" size=\"1\">
<option value=\"000000\">Vælg en farve</option>
<option value=\"000000\">Sort</option>
<option value=\"808080\">Grå</option>
<option value=\"0000ff\">Blå</option>
<option value=\"FFcc00\">Gul</option>
<option value=\"ff0000\">Rød</option>
<option value=\"00FF00\">Lyse grøn</option>
<option value=\"green\">Mørke grøn</option>
<option value=\"FF00FF\">Pink</option>
<option value=\"800080\">Lilla</option>
</select><select name=\"fontface\" style=\"font-size: 8 pt; color: #000000; font-family: Verdana; background-color: #9CA8B4; border: 1px solid #000000\" tabIndex=\"4\" size=\"1\">
<option value=\"verdana\">Vælg en skrifttype</option>
<option value=\"verdana\">Verdana</option>
<option value=\"tahoma\">Tahoma</option>
<option value=\"arial\">Arial</option>
<option value=\"comic sans ms\">Comic Sans MS</option>
</select></font></td>
</tr>
</table>
</td>
</tr>
</center>
</table>
<table border=\"0\" width=\"600\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"123\" bgcolor=\"#919191\">
<p align=\"center\"></td>
<td width=\"563\" bgcolor=\"#919191\">
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"100%\" align=\"left\">
<font face=\"Verdana\" font size=\"2\" color=\"#EEEEEE\"><b>
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td>
<font face=\"Verdana\" font size=\"2\" color=\"#EEEEEE\"><b><input type=\"submit\" name=\"submit\" value=\"Skriv..\" class=\"css\" style=\"background-color: #9CA8B4; color: #000000; font-family: Verdana; font-size: 8 pt; border: 1 solid #000000\"><input type=\"submit\" name=\"Opdater\" class=\"css\" style=\"background-color: #9CA8B4; color: #000000; font-family: Verdana; font-size: 8 pt; border: 1 solid #000000\" value=\"Opdater..\"></b></font></form></td>
</tr>
</table>
</b></font></td>
</tr>
</table>
</td>
<td width=\"4\" bgcolor=\"#919191\">
<p align=\"center\"></td>
</tr>
</table>
</td>
</tr>
</table>
<%
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"access.mdb\")
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open strDSN
strSQL = \"SELECT COUNT(id) AS Antal FROM messages\"
Set CountRs = myConn.execute(strSQL)
SQL = \"SELECT * FROM messages order by id desc\"
Set Rs = myConn.Execute(SQL)
%>
<div align=\"center\">
<center><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" height=\"1\">
<tr><td style=\"border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1\" bordercolor=\"#000000\" bgcolor=\"#808080\" height=\"1\"><p align=\"center\"><font face=\"Verdana\" size=\"1\" color=\"#EEEEEE\">
Der er <% response.write CountRs(\"Antal\") %> besked(er) i gæstebogen..</font></td></tr></table>
</center>
</div>
<%
do while not Rs.eof
%>
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"100%\" bordercolor=\"#000000\">
<div align=\"center\">
<center>
<table border=\"0\" width=\"100%\" cellspacing=\"0\">
<tr>
<td width=\"100%\" bordercolor=\"#000000\" bgcolor=\"#EEEEEE\"><font face=\"verdana\" size=\"1\" color=\"#000000\"><b><%=server.HTMLencode(rs(\"nickname\"))%>:</b><font face=\"<%=rs(\"fontface\")%>\" size=\"1\" color=\"<%=rs(\"fontcolor\")%>\"> <%=server.HTMLencode(rs(\"message\"))%></font>[<%=rs(\"time\")%>]</font></td>
</tr>
<%
rs.MoveNext
Loop
myConn.Close
Set myConn = Nothing
%>
<tr>
<td width=\"100%\" bordercolor=\"#000000\" bgcolor=\"#808080\" style=\"border-top-style: solid; border-top-width: 1\">
<p align=\"center\"><font face=\"verdana\" size=\"1\" color=\"#ff0000\"><b>OPS !!</b></font><font face=\"verdana\" size=\"1\" color=\"#EEEEEE\"><b> Hvis du skriver mere end 49 tegn, så kommer der en fejl. Bare så du ved det :-)</font></b>
</font></td> </tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</table>
</center>
</div>
