her er koden i hvert fald:
<% mode = request(\"mode\") %>
<% Response.buffer = true %>
<% if mode = \"\" then %>
<body bgcolor=\"756F6F\">
<font face=\"Arial, Helvetica, sans-serif\" size=\"4\"><b>Administration af nyheder</b></font><br>
<br>
<%
\'Connection til databasen
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.MapPath (\"nyheder.mdb\")
strSQL = \"select* from nyheder ORDER BY ID DESC\"
set rs = Conn.execute(strSQL)
if rs.EOF then
Response.write \"<font face=\"\"Verdana\"\" size=\"\"2\"\">Der er ingen indlæg i databasen!</font>\"
else
Do Until rs.EOF
%>
<%
\' Chekker om brugeren har en session.
\' Hvis ikke så smides han af
IF Session(\"password-session\") = \"\" Then
Response.Redirect(\"login.asp\")
end if
Sql = \"Select * FROM users WHERE username = \'\" & session(\"password-session\") & \"\'\"
\'set rs = rs.Execute(SQL)
%>
<form method=\"POST\" action=\"
file:///E|/Inetpub/wwwroot/admin.asp?mode=update\"><input type=\"hidden\" name=\"id\" size=\"20\" value=\"<%=RS(\"id\")%>\">
<div align=\"center\">
<center>
<table border=\"1\" width=\"170\" height=\"1\" bordercolor=\"#000000\">
<tr>
<td width=\"110\" height=\"11\">
<input type=\"text\" name=\"dato\" size=\"20\" value=\"<%=RS(\"dato\")%>\">
</td>
<td width=\"110\" height=\"11\">
<input type=\"text\" name=\"forfatter\" size=\"20\" value=\"<%=RS(\"forfatter\")%>\">
</td>
</tr>
<tr>
<td height=\"13\" colspan=\"2\">
<textarea rows=\"3\" name=\"nyhed\" cols=\"37\"><%=RS(\"nyhed\")%></textarea>
</td>
</tr>
<tr>
<td width=\"110\" height=\"1\">Slet besked
<input type=\"checkbox\" name=\"delete\" value=\"ON\">
</td>
<td width=\"110\" height=\"1\">
<input type=\"submit\" value=\"opdater/slet\" name=\"send\">
</td>
</tr>
</table>
</center>
</div>
</form>
<%RS.MoveNext
Loop
end if
Conn.Close
Set Conn = Nothing%>
<% end if %>
<% if mode = \"update\" 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(\"nyheder.mdb\") & \";UID=admin;PWD=;\"
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"Select * FROM nyheder WHERE id=\" & request.form(\"id\")
rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
%>
<% if Request.form(\"delete\") = \"ON\" then
Rs.delete
Response.Redirect \"admin.asp\"
%>
<% end if %>
<%
rs.Update
rs(\"Dato\") = Request.form(\"Dato\")
rs(\"forfatter\") = Request.form(\"forfatter\")
rs(\"Email\") = Request.form(\"email\")
rs(\"kommentar\") = Request.form(\"Kommentar\")
rs.Update
rs.Close
Set rs = Nothing
Conn.Close
set Conn = Nothing
Response.Redirect \"admin.asp\"
%>
<% end if %>