index.asp:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="shortcut icon" href="billeder/favicon.ico"/>
</head>
<body>
<div id="wrapper">
<div id="nav">
<form action="gbog/gem.asp" method="post">
navn
<input name="navn" type="text">
besked
<textarea type="textarea" cols="35" rows="15" name="besked"></textarea>
<div align="right">
<input type="button" onClick="parent.location='?action=abandon'" value="log af" class="button">
<input type="submit" class="button" name="gem" value="gem" width="49" height="25">
</form>
</div>
<div id="content">
<%
intPage = Request("page")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "Select * From wall order by id desc"
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("../database/db.mdb")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
rs.PageSize = 10
rs.AbsolutePage = intPage
intRecCount = rs.PageSize
intPageCount = rs.PageCount
%> <div align="center"> <%
Response.Write ""
If Clng(intPage) > 1 Then
Response.Write "<a href=?page=" & intPage - 1 & "><<</a>"
Else
Response.Write "<<"
End If
Response.Write " side " & intPage & " af " & intPageCount & " "
If Clng(intPage) < Clng(intPageCount) Then
Response.Write "<a href=?page=" & intPage + 1 & ">>></a>"
Else
Response.Write ">>"
End If
%>
</div>
<font class="content">
<%
Do While Not rs.EOF And intRecCount > 0
Response.Write "" & Replace(rs("besked"),chr(13),"<br/>") & ""
%>
intRecCount = intRecCount - 1
rs.MoveNext
Loop
%>
</font>
<div align="center">
<% Response.Write ""
If Clng(intPage) > 1 Then
Response.Write "<a href=/?page=" & intPage - 1 & "><<</a>"
Else
Response.Write "<<"
End If
Response.Write " side " & intPage & " af " & intPageCount & " "
If Clng(intPage) < Clng(intPageCount) Then
Response.Write "<a href=/?page=" & intPage + 1 & ">>></a>"
Else
Response.Write ">>"
End If
%></div> <%
End If
rs.Close
Set rs = Nothing
%>
</font>
</div>
</div>
</body>
</html>
gem.asp:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body>
<%
Response.charset="utf-8"
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("databasesti.mdb")
Conn.Open DSN
navn = Request.Form("navn")
besked = Request.Form("besked")
strSQL = "Insert into gb (navn, besked, dato, tid, ip) values('" & Server.HtmlEncode(Replace(request.form("navn"), "'", "''")) & "', '" & Replace(request.form("besked"),"'","''") & "','"&date()&"', '"& time&"', '" & (IP) & "')"
' SQL sætning eksekveres
Conn.Execute(strSQL)
' Luk databaseforbindelse
Conn.Close
Set Conn = Nothing
response.redirect "/"
%>
</body>
</html>