<% maxpics=16 perrow=4 connstr="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("./fpdb/gallery.mdb") set conn = Server.Createobject("adodb.connection") set rs = server.createobject("adodb.recordset") conn.open connstr name="" sql = "select name,parent from albums where id = " & request("id") rs.open sql,conn parent=0 parentname ="" if not rs.eof then if not isnull(rs("parent")) then parent = rs("parent") end if name=rs(0) end if rs.close if parent <> 0 then sql = "select name,parent from albums where id = " & parent & " order by name" rs.open sql,conn if not rs.eof then parentname = rs("name") end if rs.close end if %>

<%=name%>

<% if parent <> 0 then %>

Back to <%=parentname%>

<% end if found=false sql = "select id,name from albums where parent = " & request("id") & " order by name" rs.open sql,conn do while not rs.eof found=true response.write ""& rs("name") & "

" rs.movenext loop rs.close count=0 sql = "select count(*) from photos where albumid = " & request("id") rs.open sql,conn if not rs.eof then count=rs(0) end if rs.close p = request("p") if p="" then p= "1" if isnumeric(p) then showp=cint(p) else showp=1 end if maxpages = int(.99+ (count / maxpics)) if showp < 1 then showp= 1 if showp > maxpages then showp=maxpages sql = "select * from photos where albumid = " & request("id") & " order by position asc, ID desc" rs.open sql,conn if not rs.eof then %>
<% count=0 if showp > 1 then skip= (showp-1)* maxpics do while not rs.eof rs.movenext skip=skip-1 if skip=0 then exit do end if loop end if maincount=0 do while not rs.eof if count=0 then response.write "" %> <%rs.movenext count = count + 1 if count=perrow then count=0 response.write "" end if maincount=maincount+1 if maincount=maxpics then exit do end if loop if count > 0 then do while count < perrow response.write "" count=count+1 loop end if %>
,16*(thepage-1)+<%=maincount+1%>);" style='cursor:pointer;'>" border="0" alt="<% if rs("artist")&"" <> "" then response.write rs("artist") if rs("name")&"" <> "" then response.write " - " & rs("name") elseif rs("description") <> "" then response.write rs("description") else response.write rs("file") end if else if rs("name")&"" <> "" then response.write rs("name") elseif rs("description") <> "" then response.write rs("description") else response.write rs("file") end if end if %>">
 
<% if maxpages > 1 then response.write "
" for i =1 to maxpages if i <> showp then response.write "" & i & " " else response.write ""&i & " " end if next response.write "
" end if %> <%elseif not found then %>

No photos in this album

<% else response.write "

 

 

 

 

" end if rs.close %> <% conn.close %>