Min kilde se sådan her ud !!!!
<html>
<head>
<title>Links</title>
<style type=\"text/css\">
<!--
body {margin: 5;font-family:verdana}
a.menuitem {text-decoration:none;color:#000000}
a.menuitem:hover {text-decoration:none;color:#000000}
a {text-decoration:none;color:#333333}
a:hover {text-decoration:underline;color:#000000}
INPUT
{
BACKGROUND-COLOR: #FFFFFF;
COLOR: #000000;
FONT-FAMILY: verdana, helvetica, sans-serif;
FONT-SIZE: 12px;
FONT-STYLE: normal;
border: 1px solid #000000;
}
Textarea
{
BACKGROUND-COLOR: #FFFFFF;
COLOR: #000000;
FONT-FAMILY: verdana, helvetica, sans-serif;
FONT-SIZE: 12px;
FONT-STYLE: normal;
border: 1px solid #000000;
}
-->
</style>
</head>
<body>
<%
strMode = Request.Querystring(\"mode\")
select case strMode
case \"id\"
Response.Buffer = True
\' Her opdateres hits når brugeren bliver sendt til et link
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.MapPath(\"links.mdb\")
If Request.QueryString(\"id\") <> \"\" Then
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM links WHERE (ID = \" & Request.QueryString(\"id\") & \")\"
rs.Open strSQL, myConn, 1, 3
If Not (rs.BOF Or rs.EOF) Then
rs(\"Hits\") = rs(\"Hits\") + 1
strURL = rs(\"URL\")
rs.Update
rs.Close
myConn.Close
Set rs = Nothing
Set myConn = Nothing
Response.Clear
Response.Redirect(strURL)
End If
End If
%>
<% case \"search\"
\' Siden med søgeresultater
\' Database connection
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.MapPath(\"links.mdb\")
\' Henter søgeorden fra formularen
strKeyword = Trim(Request.Form(\"søgeord\"))
If Len(strKeyword) = 0 Then
\' Hvis der ikke er skrevet i formularen sendes brugeren tilbage
Response.Clear
Response.Redirect (\"links.asp?mode=søg\")
Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If
\' Opbygger en dynamisk SQL streng
strSQL = \"SELECT id, navn, url, beskrivelse, hits, søgeord FROM links WHERE\"
strSQL = strSQL & \" (id LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (navn LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (url LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (beskrivelse LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (hits LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (søgeord LIKE \'%\" & strKeyword & \"%\')\"
\' Skaber et recordset udfra SQL strengen
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
\' Hvis søgningen gav resultat
Response.Write \"<table width=\'500\' cellspacing=1 cellpadding=1 style=\'border-bottom: 1 solid #C0C0C0\'>\"
Response.Write \"<tr><td align=center width=\'100%\' colspan=2><font size=2><b>Søgeresultater for \" & strKeyword & \"</b></font></td></tr>\"
Do While Not rs.EOF
Response.Write \"<tr><td valign=top width=\'100%\' colspan=2 bgcolor=#e5e5e5><font size=2><b><a href=links.asp?mode=id&id=\" & rs(\"ID\") & \"> \" & rs(\"Navn\") & \"</b></font></a></td></tr>\"
Response.Write \"<tr><td valign=top width=\'80%\' bgcolor=#efefef><font size=2>\" & rs(\"Beskrivelse\") & \"</font></a></td>\"
Response.Write \"<td valign=top width=\'20%\' bgcolor=#e5e5e5><font size=2> Hits: \" & rs(\"Hits\") & \"</font></td></tr>\"
Response.Write \"<tr><td width=\'100%\' colspan=2 bgcolor=#efefef> </td></tr>\"
rs.MoveNext
Loop
Response.Write \"<tr><td width=\'100%\' colspan=2 align=right style=\'border-top: 1 solid #C0C0C0\'><font size=\'2\'><a href=\'links.asp\'>Links</a> | <a href=\'links.asp?mode=søg\'>Søg igen</a></font></td></tr>\"
Response.Write \"</table><br><br>\"
Else
\' Hvis ingen poster passede på søgordene
Response.Write \"<table width=\'500\' cellspacing=1 cellpadding=1 style=\'border-bottom: 1 solid #C0C0C0\'>\"
Response.Write \"<tr><td align=center width=\'100%\'><font size=2>Søgeresultater for \" & strKeyword & \"</font></td></tr>\"
Response.Write \"<tr><td align=center width=\'100%\' bgcolor=#e5e5e5><font size=2>Ingen sider passede på søgeordet</font></a></td></tr>\"
Response.Write \"<tr><td width=\'100%\' colspan=2 align=right style=\'border-top: 1 solid #C0C0C0\'><font size=\'2\'><a href=\'links.asp\'>Links</a> | <a href=\'links.asp?mode=søg\'>Søg igen</a></font></td></tr></table><br><br>\"
End If %>
<% case \"søg\"
\' Søgeformularen
Response.write \"<table width=\'500\' style=\'border-bottom: 1 solid #C0C0C0\'><tr><td><font size=\'2\'><b>Søg</b></font></td></tr>\"
Response.write \"<tr><td><form method=POST action=links.asp?mode=search><input type=text name=søgeord size=30></td></tr>\"
Response.write \"<tr><td><input type=submit value=\' søg \' name=send> <input type=button onclick=\'history.go(-1)\' value=tilbage name=tilbage></td></tr>\"
Response.Write \"<tr><td width=\'100%\' align=right style=\'border-top: 1 solid #C0C0C0\'><font size=\'2\'><a href=\'links.asp\'>Links</a></font></td></tr></table></form>\"
%>
<% case \"update\"
\' Sender resultaterne fra tilføj links til databasen
\' Database connection
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"links.mdb\")
\' Opbygger SQL streng
SQLstmt = \"INSERT INTO links (navn,url,beskrivelse,hits,søgeord,kategori,godkendt)\"
SQLstmt = SQLstmt & \" VALUES (\'\" & request.form(\"navn\") & \"\',\'\" & request.form(\"url\") & \"\',\'\" & request.form(\"beskrivelse\") & \"\',\'\" & request.form(\"hits\") & \"\',\'\" & request.form(\"søgeord\") & \"\',\'\" & request.form(\"kategori\") & \"\',\'ja\')\"
response.write sqlstmt
Conn.Execute (SQLstmt)
conn.Close
Set conn = nothing
Set SQLstmt = nothing
\' Sender brugeren tilbage til links når databasen er opdateret
response.redirect (\"links.asp\")
%>
<% case \"add\"
\' tilføj links
%>
<form method=\"POST\" action=\"links.asp?mode=update\">
<table border=\"0\" width=\"500\" cellpadding=\"0\" style=\'border-bottom: 1 solid #C0C0C0\'>
<tr><td colspan=\"2\"><font face=\"verdana\" size=\"2\"><b>Tilføj links</b></font></td></tr>
<tr>
<td width=\"35%\"><font face=\"Verdana\" size=\"2\"><b>Navn</font></td>
<td width=\"65%\">
<p><input type=\"text\" name=\"navn\" size=\"32\"></p>
</td>
</tr>
<tr>
<td width=\"35%\"><font face=\"Verdana\" size=\"2\"><b>url</b></font></td>
<td width=\"65%\"><input type=\"text\" name=\"url\" value=\"
http://\" size=\"32\"></td>
</tr>
<tr>
<td width=\"35%\" valign=\"top\"><font face=\"Verdana\" size=\"2\"><b>beskrivelse</b></font></td>
<td width=\"65%\"><textarea name=\"beskrivelse\" cols=\"32\" rows=\"1\"></textarea></td>
</tr>
<tr>
<td width=\"35%\" valign=\"top\"><font face=\"Verdana\" size=\"2\"><b>Kategori</b></font></td>
<td width=\"65%\"><select name=\"kategori\">
<%
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM kategorier ORDER BY kategori\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"links.mdb\")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
Do until rs.EOF = True
Response.Write \"<option value=\'\" & rs(\"kategori\") & \"\'>\" & rs(\"kategori\") & vbCrLf
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
%></select></td>
</tr>
<tr>
<td width=\"35%\" valign=\"top\"><font face=\"Verdana\" size=\"2\"><b>Søgeord</b><br>Adskilles med komma!</font></td>
<td width=\"65%\"><input type=\"text\" name=\"søgeord\" size=\"32\"></td>
</tr>
<tr>
<td width=\"100%\" colspan=\"2\"><input type=\"hidden\" value=\"0\" name=\"hits\"><input type=\"submit\" value=\"Send\" name=\"send\">
<input type=\"reset\" value=\"Annuller\" name=\"anuller\"> <input type=\"button\" onclick=\"history.go(-1)\" value=\"Tilbage\" name=\"Tilbage\"></td>
</tr>
<tr><td width=\'100%\' colspan=2 align=right style=\'border-top: 1 solid #C0C0C0\'><font size=\'2\'><a href=\'links.asp\'>Links</a> | <a href=\'links.asp?mode=søg\'>Søg i links</a></font></td></tr></table>
</form>
<% case \"vis\"
\' Hvis der ikke er valgt noget mode vises alle links
\' Paging
intPage = Request(\"page\")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If
\' Database connection
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM links WHERE kategori=\'\" & request(\"kat\") & \"\' AND godkendt=\'ja\' ORDER BY navn\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"links.mdb\")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
rs.PageSize = 25
rs.AbsolutePage = intpage
intRecCount = rs.PageSize
intPageCount = rs.PageCount
Response.Write \"<table width=\'500\' cellspacing=\'2\' cellpadding=\'0\'>\"
Do While Not rs.EOF And intRecCount > 0
Response.Write \"<tr><td valign=top width=\'100%\' colspan=2 bgcolor=#e5e5e5><font size=2><b><a href=links.asp?mode=id&id=\" & rs(\"ID\") & \">\" & rs(\"Navn\") & \"</a></b></font></td></tr>\"
Response.Write \"<tr><td valign=top width=\'80%\' bgcolor=#efefef><font size=2>\" & rs(\"Beskrivelse\") & \"</font></a></td>\"
Response.Write \"<td valign=top width=\'20%\' bgcolor=#e5e5e5><font size=2> Hits: \" & rs(\"Hits\") & \"</font></td></tr>\"
Response.Write \"<tr><td width=\'100%\' colspan=2 bgcolor=#efefef> </td></tr>\"
intRecCount = intRecCount - 1
rs.MoveNext
Loop
End If
Response.Write \"</table>\"
rs.Close
Set rs = Nothing
\' Navigering mellem siderne med paging
Response.Write \"<table width=\'500\' style=\'border-top: 1 solid #C0C0C0;border-bottom: 1 solid #C0C0C0\'><tr>\"
If Clng(intPage) > 1 Then
Response.Write \"<td><font size=\'2\'><a href=links.asp?page=\" & intPage - 1 & \" class=paging>[<<]</a></td>\"
Else
Response.Write \"<td></td>\"
End If
Response.Write \"\"
For intNum = 1 To intPageCount
Response.Write \"<td valign=\'top\'><font size=\'2\'><a href=links.asp?page=\" & intNum & \">\" & intNum & \"</a></font></td> \"
Next
If Clng(intPage) < Clng(intPageCount) Then
Response.Write \"<td><font size=\'2\'><a href=links.asp?page=\" & intPage + 1 & \" class=paging>[>>]</a></td>\"
Else
Response.Write \"<td></td>\"
End If
Response.write \"<td><font size=\'2\'>Side <b>\" & intPage & \"</b> af \" & intPageCount & \"</font></td><td><p align=\'right\'><font size=\'2\'><a href=\'links.asp\'>Oversigt</a> | <a href=\'links.asp?mode=søg\'>Søg i links</a></font></p></td></tr></table>\"
case else
\' Database connection
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM kategorier ORDER BY kategori\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"links.mdb\")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
Response.Write \"<table width=\'500\' cellspacing=\'2\' cellpadding=\'0\'>\"
Do until rs.EOF = True
Response.Write \"<tr><td width=\'100%\' colspan=2 bgcolor=#efefef><a href=\'links.asp?mode=vis&kat=\" & rs(\"kategori\") & \"\'>\" & rs(\"kategori\") & \"</a></td></tr>\"
rs.MoveNext
Loop
End If
Response.Write \"</table>\"
rs.Close
Set rs = Nothing
end select %>
</body>
</html>