Hjælp til 10 records pr. side med navigation
Følgende kode skal have lavet sidenavigation, 10 visninger i listen pr. side - << forrige side næste side >>Har lavet den til \"DNS-less\" men så knækker filmen.
<%@ Language=VBScript %>
<%
set upl = server.createobject(\"SoftArtisans.FileUp\")
slet = Request.querystring(\"slet\")
com = Request.QueryString(\"com\")
hyundai = Request.QueryString(\"hyundai\")
if slet <> \"\" then
set del = session(\"db\").execute(\"delete from tilbehoer where id =\" & slet )
end if
if com = \"ny\" then
set cre = session(\"db\").execute(\"insert into tilbehoer (tekst1,tekst2,tekst3,tekst4,tekst5,tekst6,tekst7,memo1) values(\'Mærke\',\'Model\',\'Årgang x/xxxx\',\'Antal km xx.xxx\',\'Pris xxx.xxx kr.\',\'Benzin/Diesel\',\'Nysynet/Synet x/xxxx\',\'Ydeligere Oplysninger/udstyr\')\")
end if
if com = \"edit\" then
set upd = session(\"db\").execute(\"update tilbehoer where id=\" & id)
end if
function check_change_filname(fpath, s)
set func_obj = server.createobject(\"Scripting.FileSystemObject\")
filnr = 0
if right(fpath,1) <> \"\\\" then fpath = fpath = \"\\\"
fnavn = func_obj.GetBaseName(s)
fext = func_obj.GetExtensionName(s)
kfilnavn = fnavn & \".\" & fext
fuldfilnavn = fpath & kfilnavn
do until not func_obj.FileExists(fuldfilnavn)
filnr = filnr + 1
kfilnavn = fnavn & \"_\" & filnr & \".\" & fext
fuldfilnavn = fpath & kfilnavn
loop
check_change_filname = kfilnavn
end function
if upl.Form(\"saveit\") <> \"\" then
set tilbehoer = session(\"db\").execute(\"select * from tilbehoer\")
do while not tilbehoer.eof
if upl.form(\"F1_\" & tilbehoer(\"id\")).UserFilename <> \"\" and upl.Form(\"F1_\" & tilbehoer(\"id\")).contentdisposition = \"form-data\" then
fpath = session(\"filpath\")
kfilnavn = check_change_filname(fpath, upl.form(\"F1_\" & tilbehoer(\"id\")).UserFilename)
fuldfilnavn = fpath & kfilnavn
upl.form(\"F1_\" & tilbehoer(\"id\")).SaveAs fuldfilnavn
set pb = session(\"db\").execute(\"update tilbehoer set billede1 =\'\" & kfilnavn & \"\' where id=\" & tilbehoer(\"id\") )
end if
if upl.form(\"F2_\" & tilbehoer(\"id\")).UserFilename <> \"\" and upl.Form(\"F2_\" & tilbehoer(\"id\")).contentdisposition = \"form-data\" then
fpath = session(\"filpath\")
kfilnavn = check_change_filname(fpath, upl.form(\"F2_\" & tilbehoer(\"id\")).UserFilename)
fuldfilnavn = fpath & kfilnavn
upl.form(\"F2_\" & tilbehoer(\"id\")).SaveAs fuldfilnavn
set pb = session(\"db\").execute(\"update tilbehoer set billede2 =\'\" & kfilnavn & \"\' where id=\" & tilbehoer(\"id\") )
end if
if upl.form(\"F3_\" & tilbehoer(\"id\")).UserFilename <> \"\" and upl.Form(\"F3_\" & tilbehoer(\"id\")).contentdisposition = \"form-data\" then
fpath = session(\"filpath\")
kfilnavn = check_change_filname(fpath, upl.form(\"F3_\" & tilbehoer(\"id\")).UserFilename)
fuldfilnavn = fpath & kfilnavn
upl.form(\"F3_\" & tilbehoer(\"id\")).SaveAs fuldfilnavn
set pb = session(\"db\").execute(\"update tilbehoer set billede3 =\'\" & kfilnavn & \"\' where id=\" & tilbehoer(\"id\") )
end if
set upd = session(\"db\").execute(\"update tilbehoer set tekst1 =\'\" & trim(upl.Form(\"T1_\" & tilbehoer(\"id\"))) & \"\' where id =\" & tilbehoer(\"id\") )
set upd = session(\"db\").execute(\"update tilbehoer set tekst2 =\'\" & trim(upl.Form(\"T2_\" & tilbehoer(\"id\"))) & \"\' where id =\" & tilbehoer(\"id\") )
set upd = session(\"db\").execute(\"update tilbehoer set tekst3 =\'\" & trim(upl.Form(\"T3_\" & tilbehoer(\"id\"))) & \"\' where id =\" & tilbehoer(\"id\") )
set upd = session(\"db\").execute(\"update tilbehoer set tekst4 =\'\" & trim(upl.Form(\"T4_\" & tilbehoer(\"id\"))) & \"\' where id =\" & tilbehoer(\"id\") )
set upd = session(\"db\").execute(\"update tilbehoer set tekst5 =\'\" & trim(upl.Form(\"T5_\" & tilbehoer(\"id\"))) & \"\' where id =\" & tilbehoer(\"id\") )
set upd = session(\"db\").execute(\"update tilbehoer set tekst6 =\'\" & trim(upl.Form(\"T6_\" & tilbehoer(\"id\"))) & \"\' where id =\" & tilbehoer(\"id\") )
set upd = session(\"db\").execute(\"update tilbehoer set tekst7 =\'\" & trim(upl.Form(\"T7_\" & tilbehoer(\"id\"))) & \"\' where id =\" & tilbehoer(\"id\") )
set upd = session(\"db\").execute(\"update tilbehoer set memo1 =\'\" & trim(upl.Form(\"T8_\" & tilbehoer(\"id\"))) & \"\' where id =\" & tilbehoer(\"id\") )
tilbehoer.movenext
loop
end if
%>
<html>
<head>
<title>Administration</title>
<META NAME=\"GENERATOR\" Content=\"Microsoft Visual Studio 6.0\">
<link rel=\"StyleSheet\" href=\"mstyl.css\" type=\"text/css\">
<meta name=\"Microsoft Border\" content=\"none\">
<script language=\"JavaScript\">
<!--
function fixUglyIE()
{
for (a in document.links) document.links[a].onfocus = document.links[a].blur;
}
if (document.all)
{
document.onmousedown = fixUglyIE;
}
//-->
</script>
<script language=\"javascript\">
function sletmig()
{
if (confirm(\"Vil du godtnok slette alt det arbejde?\"))
{history.forward()}
else
{
document.write(\"<meta http-equiv=\'Refresh\' content=\'0;URL=liste_adm.asp; target=_self\'>\");
location.reload()
}
}
</script>
</head>
<body leftmargin=\"20\">
<form enctype=\"multipart/form-data\" action=\"tilbehoer_adm.asp\" method=\"POST\" name=\"form1\">
<table BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"1\">
<tr>
<td><strong>Tilføj, Ret eller Slet ny bil.</strong></td>
</tr>
</table>
<br>
<DIV align=\"center\">
<center>
<TABLE WIDTH=75% BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"1\">
<TR>
<TD><A href=\"tilbehoer_adm.asp?com=ny\"><img SRC=\"../images/ny.gif\" Border=\"0\" height=\"24\" alt=\"Tilføj ny bil\"></A> <img SRC=\"../images/space.gif\" Border=\"0\" height=\"24\"></td>
<td>Sortér efter</td>
<td><a href=\"liste_adm.asp?com=maerke\">Mærke</a></td>
<td><a href=\"liste_adm.asp?com=model\">Model</a></td>
<td><a href=\"liste_adm.asp?com=aargang\">Årgang</a></td>
<td><a href=\"liste_adm.asp?com=km\">Km</a></td>
<td><a href=\"liste_adm.asp?com=pris\">Pris</a></td>
<td>Foto</td>
</TR>
<!--#include file=\"../include/com_add.asp\"-->
<% do while not tilbehoer.eof %>
<tr>
<TD>
<A href=\"tilbehoer_adm.asp?slet=<%=tilbehoer(\"id\")%>\" onclick=\"sletmig()\"><img SRC=\"../images/del.gif\" Border=\"0\" height=\"24\" alt=\"Slet denne bil\"></A> <A href=\"tilbehoer_adm_edit.asp?id=<%=tilbehoer(\"id\")%>\"><img SRC=\"../images/edit.gif\" Border=\"0\" height=\"24\" alt=\"Ret denne bil\"></A>
</TD>
<TD>
<a href=\"tilbehoer_adm_edit.asp?id=<%=tilbehoer(\"ID\")%>\"><%=tilbehoer(\"ID\")%></a>
</td>
<TD>
<%=tilbehoer(\"tekst1\")%>
</td>
<td>
<%=tilbehoer(\"tekst2\")%>
</td>
<td>
<%=tilbehoer(\"tekst3\")%>
</td>
<td>
<%=tilbehoer(\"tekst4\")%>
</td>
<td>
<%=tilbehoer(\"tekst5\")%> kr.
</td>
<td align=\"center\">
<% if tilbehoer(\"billede1\") <> \"\" then %>
<a href=\"tilbehoer_adm_edit.asp?id=<%=tilbehoer(\"ID\")%>\"><img src=\"../images/foto.gif\" border=\"0\"></a>
<% else %>
<img src=\"../images/space.gif\">
<% end if %>
</td>
</TR>
<% tilbehoer.movenext %>
<% loop %>
</CENTER>
</DIV>
</TABLE>
</FORM>
</body>
