<%@ Language=VBScript %> <% DIM conn,conString,gallerySQL,pictureSQL,galleryRS,pictureRS,canCreate //On Error Resume Next Set conn = Server.CreateObject("ADODB.Connection") conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & application("conString") DIM gallery_id,gallery_name,gallery_description,gallery_thumbnail gallery_id = CInt(request.QueryString("gallery")) if gallery_id <> -1 then gallerySQL = "SELECT gallery_name,gallery_description,gallery_thumbnail FROM gallery WHERE gallery_id = " & gallery_id Set galleryRS = conn.Execute(gallerySQL) gallery_name = galleryRS("gallery_name") gallery_description = galleryRS("gallery_description") gallery_thumbnail = galleryRS("gallery_thumbnail") else //only allow logged in admin users to view this gallery... if StrComp(Session("SessionPermissions"),"admin") <> 0 then response.redirect "login.asp" end if gallery_name = "portmanteau" gallery_description = "Where all the lonely pictures go." gallery_thumbnail = "..\images\nogallery.jpg" end if pictureSQL = "SELECT picture_id,picture_title,picture_thumbnail,picture_height,picture_width, picture_sort FROM picture WHERE picture.gallery_id = " & gallery_id & " ORDER BY picture_sort,picture_id" Set pictureRS = conn.Execute(pictureSQL) if StrComp(Session("SessionPermissions"),"admin") = 0 then canCreate = true else canCreate = false end if %> <%=gallery_name%>

<%=gallery_name%>

<% if canCreate then %> add picture <% end if %>
<%=gallery_description%>
<% dim count count = 0 while not pictureRS.EOF %> <% count = count + 1 if count = 4 then %> <% count = 0 end if pictureRS.MoveNext wend %>
<%=pictureRS("picture_title")%> <% if canCreate then %> <% if gallery_id <> -1 then %>
modify | remove <% else %>
modify | delete <% end if %>
<% end if %>
<% conn.close set RS = nothing set pictureRS = nothing set conn = nothing %>