Hele koden ses her
*******
<% response.buffer = true %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="Generator" content="Stone's WebWriter 4 BETA 4a">
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title><!--#include file="baskettitel.inc"--></title>
<LINK REL="stylesheet" HREF="css/sbbctypo1.css" TYPE="text/css">
</head>
<body>
<div id="header">
<div id="headerblock"> <IMG SRC="images/header.gif" ALT="">
</div>
</div>
<div id="navbar">
<!--#include file="navbarmenu.inc"--> </div>
<div class="spacer"> </div>
<div id="content">
<div class="col1">
<!--#include file="venstremenu.asp"-->
</div>
<div class="col2"><DIV STYLE="text-align:center"><!--#include file="banner.asp"--></DIV> <h3>LINKSSAMLING</h3>
<%
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 * FROM links WHERE"
strSQL = strSQL & " (godkendt = 'ja') AND ("
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 & "%'))"
Response.Write "<table width=""400"" cellspacing=""0"" cellpadding=""2"">"
Response.Write "<tr><td width=""100%"" colspan=""2"" bgcolor=""#fffff3""><font size=""1""><b>Links</b> » <b>Søgeresultater for " & strKeyword & "</b></font></td></tr>"
Response.Write "<tr><td bgcolor=""#fffff3""><font size=""1""><b>Navn/beskrivelse</b></font></td><td bgcolor=""#fffff3""><font size=""1""><b>Hits</b></font></td></tr>"
' Skaber et recordset udfra SQL strengen
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
' Hvis søgningen gav resultat
Do While Not rs.EOF
If farve=1 Then
bg="#fffff3"
Farve= Farve + 1
Else
bg="#fffff3"
farve=1
End If
Response.Write "<tr><td valign=top bgcolor=" & bg & "><font size=1><b><a href=""links.asp?mode=id&id=" & rs("ID") & """ target=""_blank"">" & rs("Navn") & "</a></b><br>" & rs("Beskrivelse") & "</font></td>"
Response.Write "<td valign=top align=center width='30' bgcolor=" & bg & "><font size=1>" & rs("Hits") & "</font></td></tr>"
rs.MoveNext
Loop
Else
' Hvis ingen poster passede på søgordene
Response.Write "<tr><td align=center width=""100%"" colspan=""2"" bgcolor=#fffff3><font size=""1""><b>Ingen sider passede på søgeordet</b></font></a></td></tr>"
End If
response.write "<tr><td align=""right"" colspan=""2"" bgcolor=""#fffff3""><font size=""1""><b><a href=""links.asp"" >» Oversigt</a> <a href=""links.asp?mode=søg"" >» Søg igen</a> <a href=""links.asp?mode=add"" >» Tilføj links</a></b> </font></td></tr></table></td></tr>"
Response.Write "</table><br><br>"
%>
<% case "søg"
' Søgeformularen
Response.write "<form method=POST action=links.asp?mode=search><table width=""400"" cellspacing=""0"" cellpadding=""2"" border=""0"">"
Response.write "<tr><td bgcolor=""#fffff3""><font size=""1""><b>Links</b> » <b>Søg</b></font></td></tr>"
Response.write "<tr><td bgcolor=""#fffff3""><input type=""text"" name=""søgeord"" size=""60""></td></tr>"
Response.write "<tr><td bgcolor=""#fffff3""><input type=""submit"" value="" søg "" name=""send""></td></tr>"
response.write "<tr><td align=""right"" bgcolor=""#fffff3""><font size=""1""><b><a href=""links.asp"" >» Oversigt</a> <a href=""links.asp?mode=add"" >» Tilføj links</a></b> </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("database/links.mdb")
' Opbygger SQL streng
SQLstmt = "INSERT INTO links (navn,url,beskrivelse,hits,kategori,godkendt,søgeord,)"
SQLstmt = SQLstmt & " VALUES ('" & request.form("navn") & "','" & request.form("url") & "','" & replace(request.form("beskrivelse"),"'","''") & "','" & request.form("hits") & "','" & "','" & request.form("kategori") & "','nej')" & request.form("søgeord")
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 ("links1.asp")
%>
<% case "add"
' tilføj links
%>
<form method="POST" action="links.asp?mode=update">
<table border="0" width="400" cellpadding="2" cellspacing="0">
<tr><td colspan="2" bgcolor="#fffff3"><font face="verdana" size="1"><b>Links</b></font></td></tr>
<tr><td colspan="2" bgcolor="#fffff3"><font face="verdana" size="1"><b>Tilføj link</b></font></td></tr>
<tr>
<td width="35%" bgcolor="#fffff3"><font face="Verdana" size="1"><b>Navn</font></td>
<td width="65%" bgcolor="#fffff3">
<p><input type="text" name="navn" size="32"></p>
</td>
</tr>
<tr>
<td width="35%" bgcolor="#fffff3"><font face="Verdana" size="1"><b>URL</b></font></td>
<td width="65%" bgcolor="#fffff3"><input type="text" name="url" value="
http://" size="32"></td>
</tr>
<tr>
<td width="35%" bgcolor="#fffff3" valign="top"><font face="Verdana" size="1"><b>Beskrivelse</b></font></td>
<td width="65%" bgcolor="#fffff3"><textarea name="beskrivelse" cols="32"></textarea></td>
</tr>
<tr>
<td width="35%" bgcolor="#fffff3" valign="top"><font face="Verdana" size="1"><b>Kategori</b></font></td>
<td width="65%" bgcolor="#fffff3"><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("database/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("id") & "'>" & rs("kategori") & vbCrLf
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
%></select></td>
</tr>
<tr>
<td width="35%" bgcolor="#fffff3" valign="top"><font face="Verdana" size="1"><b>Søgeord</b><br>Adskilles med komma!</font></td>
<td width="65%" bgcolor="#E5E5E5"><input type="text" name="søgeord" size="32"></td>
</tr>
<tr>
<td width="100%" bgcolor="#fffff3" colspan="2"><input type="hidden" value="0" name="hits"><input type="submit" value="Send" name="send" style="background-color:#fffff3">
<input type="reset" value="Annuller" name="anuller" style="background-color:#fffff3"></td>
</tr>
<tr><td colspan="2" align="right" bgcolor="#fffff3"><font size="1"><b><a href="links.asp" >» Links</a> <a href="links.asp?mode=søg" >» Søg i links</a></b> </font></td></tr></table>
</form>
<% case "vis"
' Hvis der ikke er valgt noget mode vises alle links
' Paging
intPage = Request("page")
rpage = "&page=" & request("page")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
rpage = "&page=1"
End If
orderby = request("orderby")
if request("orderby") <> "" then
orderby = request("orderby")
else
orderby = "navn"
end if
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database/links.mdb")
Set kat = Conn.Execute("SELECT kategori FROM kategorier WHERE id=" & request("kat") & "")
katg = kat("kategori")
Set kat = nothing
Conn.Close
Set Conn = Nothing
' Database connection
Response.Write "<table width='400' cellspacing='0' cellpadding='2'>"
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM links WHERE kategori='" & request("kat") & "' AND godkendt='ja' ORDER BY " & orderby & ""
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("database/links.mdb")
rs.Open strSQL, strDSN, 1
Response.Write "<tr><td width='100%' colspan=""2"" bgcolor=""#fffff3""><font size=""2""><b>Kategori</b> » <b>" & katg & "</b></font></td></tr>"
If Not (rs.BOF Or rs.EOF) Then
Response.Write "<tr><td bgcolor=""#fffff3""><font size=""1""><b><a href=""links.asp?mode=vis&kat=" & request("kat") & rpage & "&orderby=navn"" class=""menu"">Navn/beskrivelse</a></b></font></td><td bgcolor=""#fffff3"" align=""center""><font size=""1""><b><a href=""links.asp?mode=vis&kat=" & request("kat") & rpage & "&orderby=hits"" class=""menu"">Hits</a></b></font></td></tr>"
rs.PageSize = 5
rs.AbsolutePage = intPage
intRecCount = rs.PageSize
intPageCount = rs.PageCount
Do While Not rs.EOF And intRecCount > 0
If farve=1 Then
bg="#fffff3"
Farve= Farve + 1
Else
bg="#fffff3"
farve=1
End If
Response.Write "<tr><td valign=top bgcolor=" & bg & "><font size=2><b><a href=""links.asp?mode=id&id=" & rs("ID") & """ target=""_blank"">" & rs("Navn") & "</a></b><br>" & rs("Beskrivelse") & "</font></td>"
Response.Write "<td valign=top align=center width='30' bgcolor=" & bg & "><font size=2>" & rs("Hits") & "</font></td></tr>"
intRecCount = intRecCount - 1
rs.MoveNext
Loop
else
response.write "<tr><td colspan=""2"" align=""center""><font size=""1""><b>Der er ingen links i denne kategori!</b></font></td><tr>"
End If
rs.Close
Set rs = Nothing
' Navigering mellem siderne med paging
Response.Write "<tr><td colspan=""2"" bgcolor=""#fffff3"">"
Response.Write "<table border=""0"" cellspacing=""0"" cellpadding=""2"" width=""100%""><tr><td bgcolor=""#fffff3""><font size='1'>"
If Clng(intPage) > 1 Then
Response.Write "<a href=links.asp?mode=vis&kat=" & request("kat") & "&page=" & intPage - 1 & "&orderby=" & request("orderby") & " class=""menu"">[<<]</a> "
Else
Response.Write ""
End If
Response.Write ""
For intNum = 1 To intPageCount
Response.Write " <a href=links.asp?mode=vis&kat=" & request("kat") & "&page=" & intNum & "&orderby=" & request("orderby") & " class=""menu""><b>" & intNum & "</b></a> "
Next
If Clng(intPage) < Clng(intPageCount) Then
Response.Write " <a href=links.asp?mode=vis&kat=" & request("kat") & "&page=" & intPage + 1 & "&orderby=" & request("orderby") & " class=""menu"">[>>]</a>"
Else
Response.Write ""
End If
Response.write "</b> Side <b>" & intPage & "</b> af " & intPageCount & "</font></td></tr><tr><td align=""right""><br><font size=""1""><b><a href='links.asp' class=""menu"">» Oversigt</a> <a href='links.asp?mode=søg' class=""menu"">» Søg i links</a> <a href='links.asp?mode=add' class=""menu"">» Tilføj links</a></b> </font></td></tr></table></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("database/links.mdb")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
Response.Write "<table width='400' cellspacing='0' cellpadding='2'>"
Response.Write "<tr><td width='400' bgcolor=""#fffff3""><font size=""2""><b>KATEGORIER</b></font></td></tr>"
Do until rs.EOF = True
If farve=1 Then
bg="#fffff3"
Farve= Farve + 1
Else
bg="#fffff3"
farve=1
End If
Response.Write "<tr><td width='100%' bgcolor=""" & bg & """><font size=""2""><a href='links.asp?mode=vis&kat=" & rs("id") & "&orderby=navn'><b>" & rs("kategori") & "</b></a></font></td></tr>"
rs.MoveNext
Loop
End If
Response.Write "<tr><td align=""right"" bgcolor=""#fffff3""><font size=""1""><b><a href='links.asp?mode=søg' class=""menu"">» Søg i links</a> <a href='links.asp?mode=add' class=""menu"">» Tilføj links</a></b> </font></td></tr>"
Response.Write "</table>"
rs.Close
Set rs = Nothing
end select %>
</div>
<div class="col3">
<div style="text-align:center"><img src="images/logosbbc.gif" border="0" width="150" height="231" alt="">
<!-- Chart Basis HTML kode start v003 -->
<script language="javascript" type="text/javascript">
<!--
document.write('<a href="
http://www.chart.dk/ref.asp?ct=v003&id=20980" target="_blank">');
var myref; myref=document.referrer;
document.write('<img src="
http://cluster.chart.dk/chart.asp?id=20980&style=3&secID=' + Math.random()*10000000 + '&ref=' + escape(myref) + '" border="0" alt="Chart.dk"><');
document.write('/a>');
//-->
</script>
<noscript>
<a href="
http://www.chart.dk/ref.asp?ct=v003&id=20980" target="_blank"><img src="
http://cluster.chart.dk/chart.asp?id=20980&style=3&secID=1" border="0" alt="Chart.dk"></a>
</noscript>
<!-- Chart Basis HTML kode slut v003 --></div>
</div>
</div>
<div class="spacer"> </div>
<div id="footer">
<div id="footertext">copyright: svendborg basketball club 2002</div>
</div>
</body>
</html>
******
Link til hjemmeside
http://www.sbbc.dk/links.dk