Åbn og luk databaser
Jeg har fået lidt brok fra min ISP, der siger at det tager for meget hukommelse at bruge Session.Timeout.Vi skal altså åbne forbindelsen til databasen og når kunden forlader pågældende varekategori skal den derefter lukkes igen, samtidig med at varen stadig er i kurven.
Nu går man ind i den enkelte kategori, markerer de ønskede varer og gør evt det samme i de andre varekategorier. Derefter kan man gå til indkøbskurven hvor man vælger betalingsmåde og så sendes videre til en side hvor man endeligt skal indtaste navn m.m
Kurven kører perfekt nu, men har nogen et bud på hvordan jeg undgår belastningen på serveren, på en meget let måde, da jeg ikke er for snu til asp selv.
Hvis det kræver en større indsats er jeg villig til at betale mig fra det..
Her er lidt kode på en enkelt kategori.
<%
Response.Buffer = True
Response.Expires = -1
Response.AddHeader \"pragma\", \"no-cache\"
Session.Timeout = 10
Session(\"betal\") = \"\"
Session(\"betalpris\") = 0
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"database\"
strQuery = \"SELECT * FROM varer where kategori=\'kategori1\' ORDER BY navn\"
Set RS = Conn.Execute(strQuery)
%>
<html>
<head>
<title></title>
</head>
<body link=\"#000000\" vlink=\"#000000\" alink=\"#000000\" leftmargin=\"0\" topmargin=\"15\" bgcolor=\"#0A4A08\">
<div align=\"center\">
<center>
<table border=\"0\" width=\"759\" cellspacing=\"0\" cellpadding=\"0\" height=\"530\">
<tr>
<td width=\"100%\" bgcolor=\"#C0C0C0\" height=\"530\">
<div align=\"center\">
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td>
<div align=\"center\">
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td rowspan=\"2\" bgcolor=\"#FFFFFF\"><img border=\"0\" src=\"../billeder/top_venstre.gif\" width=\"82\" height=\"70\"></td>
<td bgcolor=\"#FFFFFF\"><img border=\"0\" src=\"../billeder/top_stor.gif\" width=\"325\" height=\"43\"></td>
<td bgcolor=\"#FFFFFF\"><img src=\"../billeder/top_lille.gif\" width=\"84\" height=\"43\" border=\"0\"></td>
<td rowspan=\"2\" bgcolor=\"#FFFFFF\"><img src=\"../billeder/top_logo.gif\" border=\"0\" width=\"268\" height=\"70\"></td>
</tr>
<tr>
<td bgcolor=\"#FFFFFF\">
<map name=\"FPMap0\">
<area href=\"../index.htm\" shape=\"rect\" coords=\"91, 6, 175, 26\">
<area href=\"../handel.htm\" shape=\"rect\" coords=\"229, 7, 281, 26\">
<area href=\"../links.htm\" shape=\"rect\" coords=\"279, 7, 324, 26\">
<area href=\"forum.asp\" shape=\"rect\" coords=\"175, 8, 233, 26\">
<area href=\"kategori6.asp\" shape=\"rect\" coords=\"45, 9, 96, 26\"></map><img border=\"0\" src=\"../billeder/top_menu.gif\" width=\"325\" height=\"27\" usemap=\"#FPMap0\"></td>
<td bgcolor=\"#FFFFFF\"><map name=\"FPMap1\">
<area href=\"../help_files/help.htm\" shape=\"rect\" coords=\"1, 4, 57, 26\"></map><img src=\"../billeder/top_midt.gif\" name=\"andre\" width=\"84\" height=\"27\" border=\"0\" usemap=\"#FPMap1\"></td>
</tr>
</center>
<tr>
<td colspan=\"4\" bgcolor=\"#C0C0C0\">
<p align=\"center\"><font face=\"Arial\"><img border=\"0\" src=\"../billeder/megabar.gif\" width=\"759\" height=\"32\"></font></td>
</tr>
<center>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
</td>
<td bgcolor=\"#C0C0C0\">
</td>
</tr>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
<p align=\"center\"><b><font face=\"Arial\" size=\"3\">Rituelle
Urter</font></b></p>
</td>
</center>
<td bgcolor=\"#C0C0C0\" rowspan=\"2\">
<p align=\"right\"><a href=\"kurv1.asp\"><img border=\"0\" src=\"../billeder/kurv.gif\" width=\"115\" height=\"35\"></a> </td>
</tr>
<center>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
<font face=\"Arial\" color=\"#000000\" size=\"2\"> </font>
</td>
</tr>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
<font face=\"Arial\" color=\"#000000\" size=\"2\">
Gennem alle tider har mennesket søgt svar i sig selv
eller i den spirituelle verden. </font></td>
<td bgcolor=\"#C0C0C0\">
</td>
</tr>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
<font face=\"Arial\" color=\"#000000\" size=\"2\">
I Vesten forsvandt brugen af entheogener med
kristendommens udbredelse, men i</font></td>
</center>
<td bgcolor=\"#C0C0C0\">
<p align=\"right\"><font face=\"Arial\" size=\"2\"><b><img border=\"0\" src=\"../billeder/pil.jpg\" width=\"11\" height=\"9\">
<a href=\"kategori7.asp\">Psilocybin Svampe</a> </b></font></td>
</tr>
<center>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
<p align=\"left\"><font face=\"Arial\" color=\"#000000\" size=\"2\">
resten af verden er entheogener blevet brugt religiøst helt
op i vor tid. </font>
</td>
<td bgcolor=\"#C0C0C0\">
<p align=\"right\"><font face=\"Arial\" size=\"2\" color=\"#FF0000\"><b>Rituelle
Frø og Urter </b></font></td>
</tr>
</center>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
<p align=\"left\">
<font face=\"Arial\" color=\"#000000\" size=\"2\">
Ethnoplanet har samlet en mængde entheogener fra hele
verden, der i</font>
</td>
<center>
<td align=\"right\" bgcolor=\"#C0C0C0\">
<p align=\"right\"><font face=\"Arial\" size=\"2\"><b><img border=\"0\" src=\"../billeder/pil.jpg\" width=\"11\" height=\"9\">
<a href=\"kategori2.asp\">Stimulerende Urter</a> </b></font></td>
</tr>
</center>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
<p align=\"left\"><font face=\"Arial\" color=\"#000000\" size=\"2\">
forskellige samfund og kulturer er blevet brugt til
religiøse eller cerimonielle formål.</font>
</td>
<center>
<td align=\"right\" bgcolor=\"#C0C0C0\">
<font face=\"Arial\" size=\"2\"><b><img border=\"0\" src=\"../billeder/pil.jpg\" width=\"11\" height=\"9\">
<a href=\"kategori3.asp\">Naturlige Smartdrugs</a> </b></font></td>
</tr>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
<font face=\"Arial\" color=\"#000000\" size=\"2\"> </font>
</td>
<td align=\"right\" bgcolor=\"#C0C0C0\">
<font face=\"Arial\" size=\"2\"><b><img border=\"0\" src=\"../billeder/pil.jpg\" width=\"11\" height=\"9\">
<a href=\"kategori4.asp\">Gør-Det-Selv Kits</a> </b></font></td>
</tr>
<tr>
<td colspan=\"3\" bgcolor=\"#C0C0C0\">
</td>
<td align=\"right\" bgcolor=\"#C0C0C0\">
<font face=\"Arial\" size=\"2\"><b><img border=\"0\" src=\"../billeder/pil.jpg\" width=\"11\" height=\"9\">
<a href=\"kategori5.asp\">Diverse</a> </b></font></td>
</tr>
</table>
</div>
</center>
</td>
</tr>
</table>
</div>
<% If not (rs.BOF Or rs.EOF) Then %>
<form method=\"POST\" action=\"kurv1.asp?mode=bestil\">
<div align=\"center\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"740\" bgcolor=\"#0A4A08\" height=\"37\">
<tr>
<td width=\"100%\" bgcolor=\"#008442\" height=\"18\">
<p align=\"left\"><font size=\"2\" face=\"Arial\" color=\"#FFFFFF\">
Marker de produkter du ønsker og tilpas evt. antallet.
Tryk på "Tilføj varer" når du er klar.</font></td>
</tr>
<tr>
<td width=\"100%\" bgcolor=\"#008442\" height=\"19\">
<p align=\"left\"> <font face=\"Arial\" size=\"1\"><a href=\"../help_files/help1.htm\">Hjælp
til bestilling</a></font></p>
</td>
</tr>
</table>
</div>
<center>
<div align=\"center\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"740\" bgcolor=\"#F2F2F2\">
<tr>
<td width=\"60\" bgcolor=\"#D8D8D8\">
<p align=\"center\"><font face=\"Arial\" size=\"2\" color=\"#004676\"><img border=\"0\" src=\"../billeder/kob.gif\" width=\"29\" height=\"11\"></font></td>
<td width=\"60\" bgcolor=\"#D8D8D8\">
<p align=\"center\"><font size=\"2\" face=\"Arial\" color=\"#0A4A08\">Antal</font></td>
<td width=\"140\" bgcolor=\"#D8D8D8\">
<p align=\"center\"><font face=\"Arial\" size=\"2\" color=\"#0A4A08\">Navn</font></td>
<td width=\"270\" bgcolor=\"#D8D8D8\">
<p align=\"center\"><font face=\"Arial\" size=\"2\" color=\"#0A4A08\">Beskrivelse</font></td>
<td width=\"100\" bgcolor=\"#D8D8D8\">
<p align=\"center\"><font face=\"Arial\" size=\"2\" color=\"#0A4A08\">Billede</font></td>
<td bgcolor=\"#D8D8D8\">
<p align=\"center\"><font face=\"Arial\" size=\"2\" color=\"#0A4A08\">Pris</font></td>
</tr>
</table>
</div>
<div align=\"center\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"740\" bgcolor=\"#004676\">
<tr>
<td width=\"100%\" bgcolor=\"#008442\"> </td>
</tr>
</table>
</div>
<% do while not rs.eof %>
<div align=\"center\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"740\" bgcolor=\"#F2F2F2\">
<tr>
<td width=\"60\" align=\"center\" bgcolor=\"#D8D8D8\">
<font face=\"Arial\" size=\"2\">
<% if session(\"bestil\" & rs(\"id\") & \"\") = \"true\" then
response.write \"<input type=\'checkbox\' name=\'bestil\" & rs(\"id\") & \"\' value=\'true\' checked>\"
else
response.write \"<input type=\'checkbox\' name=\'bestil\" & rs(\"id\") & \"\' value=\'true\'>\"
end if
%>
</font>
</td>
<td width=\"60\" align=\"center\" bgcolor=\"#D8D8D8\">
<font face=\"Arial\" size=\"2\">
<% if not session(\"antal\" & rs(\"id\") & \"\") = \"\" then
response.write \"<input type=\'text\' name=\'antal\" & rs(\"id\") & \"\' size=\'3\' value=\'\" & session(\"antal\" & rs(\"id\") & \"\") & \"\'>\"
else
response.write \"<input type=\'text\' name=\'antal\" & rs(\"id\") & \"\' size=\'3\' value=\'1\'>\"
end if %>
</font>
</td>
<td width=\"140\" align=\"center\" bgcolor=\"#D8D8D8\"><font face=\"Arial\" size=\"2\"><b><%=rs(\"navn\")%></b></font></td>
</center>
<td width=\"270\" align=\"center\" bgcolor=\"#D8D8D8\">
<p align=\"left\"><font face=\"Arial\" size=\"2\"><%=Replace(rs(\"beskrivelse\")&\"\", vbCrLf, \"<br>\") %></font></td>
<center>
<td width=\"100\" align=\"center\" bgcolor=\"#D8D8D8\"><img border=\"0\" src=\"<%=rs(\"billedeurl\")%>\" width=\"100\" height=\"100\"></td>
<td align=\"center\" bgcolor=\"#D8D8D8\"><font face=\"Arial\" size=\"2\"><%= Formatnumber(rs(\"pris\"),2)%> Kr</font></td>
</tr>
</table>
</div>
<div align=\"center\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"740\" bgcolor=\"#0A4A08\">
<tr>
<td width=\"100%\" bgcolor=\"#008442\"> </td>
</tr>
</table>
</div>
<%
rs.movenext
loop
%>
<p align=\"center\">
<input type=\"submit\" name=\"submit\" value=\"Tilføj varer\">
</form>
<% end if %>
<div align=\"center\">
<table border=\"0\" width=\"754\" cellspacing=\"0\" cellpadding=\"0\" height=\"1\">
<tr valign=\"top\">
<td align=\"left\" height=\"1\" bgcolor=\"#C0C0C0\">
<font face=\"Arial\" size=\"2\"><i><font color=\"#ff0000\">!</font>
tekst</i></font>
</td>
<td width=\"162\" bgcolor=\"#C0C0C0\" valign=\"top\" align=\"right\" height=\"1\">
<table border=\"0\" width=\"162\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#0A4A08\">
<tr>
<td bgcolor=\"#FFFFcc\"><img border=\"0\" src=\"../billeder/lille_v.gif\" width=\"6\" height=\"19\"></td>
<td width=\"100%\" bgcolor=\"#0A4A08\"><p align=\"center\"><font face=\"Arial\" size=\"2\" color=\"#ffffff\"><b>Kontakt</b></font></p></td>
<td><img border=\"0\" src=\"../billeder/lille_h.gif\" width=\"6\" height=\"19\"></td>
</tr>
</table>
<table border=\"1\" cellspacing=\"0\" width=\"163\" cellpadding=\"0\" bgcolor=\"#ffffff\" bordercolorlight=\"#0A4A08\" bordercolor=\"#ffffff\" bordercolordark=\"#ffffff\">
<tr>
<td width=\"100%\" valign=\"top\">
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"100%\" align=\"center\" bgcolor=\"#FFFFFF\"><font face=\"Arial\" size=\"1\"><b>Webmaster</b></font></td>
</tr>
<tr>
<td width=\"100%\" align=\"center\">
<p align=\"center\"><a href=\"mailto:Webmaster@ethnoplanet.dk\"><font face=\"Arial\" size=\"1\">webmaster@ethnoplanet.dk</font></a></td>
</tr>
<tr>
<td width=\"100%\" align=\"center\" bgcolor=\"#FFFFff\"><font face=\"Arial\" size=\"1\"><b>Webshoppen</b></font></td>
</tr>
<tr>
<td width=\"100%\" align=\"center\" bgcolor=\"#FFFFff\"><p align=\"center\"><a href=\"mailto:bestilling@ethnoplanet.dk\"><font face=\"Arial\" size=\"1\">bestilling@ethnoplanet.dk</font></a></td>
</tr>
<tr>
<td width=\"100%\" align=\"center\" bgcolor=\"#FFFFff\"> </td>
</tr>
<tr>
<td width=\"100%\" align=\"center\" bgcolor=\"#FFFFff\"><a href=\"../fax.txt\" target=\"_blank\"><font face=\"Arial\" size=\"1\">Fax:
</font></a><a href=\"../fax.txt\" target=\"_blank\"><font face=\"Arial\" size=\"1\">44538045</font></a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr valign=\"top\">
<td align=\"left\" height=\"0\" bgcolor=\"#C0C0C0\">
</td>
<td width=\"162\" bgcolor=\"#C0C0C0\" valign=\"top\" align=\"right\" height=\"0\">
</td>
</tr>
</table>
</div>
</center>
</td>
</tr>
</table>
</div>
<div align=\"center\">
<center>
<table border=\"0\" width=\"759\" cellspacing=\"0\" cellpadding=\"0\" height=\"1\">
<tr>
<td width=\"100%\" height=\"22\"><img border=\"0\" src=\"../billeder/bundlinje.gif\" width=\"759\" height=\"20\"></td>
</tr>
</table>
</center>
</div>
</body>
</html>