<% dim submission_link dim CatId dim Downloads dim EMail dim ContentId dim user_id dim RelatedURL dim Title dim Author dim DateAdded dim ShortDesc dim FileName dim DownloadURL dim detail_content_sql dim Display dim Expire dim Priority dim Impressions dim ClickThrus dim Ratings dim ContentType dim ContentTypeId dim Cat dim blank_row dim view_content_sql sub request_detail_content ''' request form inputs from this form Downloads = request("Downloads") EMail = request("EMail") ContentId = request("ContentId") user_id = request("user_id") CatId = request("CatId") RelatedURL = request("RelatedURL") Title = request("Title") Author = request("Author") DateAdded = request("DateAdded") ShortDesc = request("ShortDesc") FileName = request("FileName") DownloadURL = request("DownloadURL") end sub sub request_view_content ''' request form inputs from this form Display = request("Display") EMail = request("EMail") Expire = request("Expire") Priority = request("Priority") Impressions = request("Impressions") ClickThrus = request("ClickThrus") Ratings = request("Ratings") ContentType = request("ContentType") ContentId = request("ContentId") user_id = request("user_id") ContentTypeId = request("ContentTypeId") CatId = request("CatId") DownloadURL = request("DownloadURL") FileName = request("FileName") RelatedURL = request("RelatedURL") Cat = request("Cat") Title = request("Title") Author = request("Author") DateAdded = request("DateAdded") blank_row = request("blank_row") end sub sub validate_detail_content ''' request and validate data entered from this form Downloads = trim(request("Downloads")) EMail = trim(request("EMail")) ContentId = trim(request("ContentId")) user_id = trim(request("user_id")) CatId = trim(request("CatId")) RelatedURL = trim(request("RelatedURL")) Title = trim(request("Title")) Author = trim(request("Author")) DateAdded = trim(request("DateAdded")) if DateAdded <> "" AND (not isdate(DateAdded)) then error_list.add "578802date","Submitted must be a valid date (MM/DD/YY)." b_error = true end if ShortDesc = trim(request("ShortDesc")) FileName = trim(request("FileName")) DownloadURL = trim(request("DownloadURL")) end sub sub validate_view_content ''' request and validate data entered from this form Display = trim(request("Display")) EMail = trim(request("EMail")) Expire = trim(request("Expire")) if Expire <> "" AND (not isdate(Expire)) then error_list.add "578811date","Expire must be a valid date (MM/DD/YY)." b_error = true end if Priority = trim(request("Priority")) Impressions = trim(request("Impressions")) ClickThrus = trim(request("ClickThrus")) Ratings = trim(request("Ratings")) ContentType = trim(request("ContentType")) ContentId = trim(request("ContentId")) user_id = trim(request("user_id")) ContentTypeId = trim(request("ContentTypeId")) CatId = trim(request("CatId")) DownloadURL = trim(request("DownloadURL")) FileName = trim(request("FileName")) RelatedURL = trim(request("RelatedURL")) Cat = trim(request("Cat")) Title = trim(request("Title")) Author = trim(request("Author")) DateAdded = trim(request("DateAdded")) if DateAdded <> "" AND (not isdate(DateAdded)) then error_list.add "578808date","Submitted must be a valid date (MM/DD/YY)." b_error = true end if blank_row = trim(request("blank_row")) end sub sub get_defaults_view_content ''' set default values for this form Display = 1 end sub sub db_select_detail_Content sql = "SELECT " & _ "Downloads, " & _ "EMail, " & _ "ContentId, " & _ "user_id, " & _ "CatId, " & _ "RelatedURL, " & _ "Title, " & _ "Author, " & _ "DateAdded, " & _ "ShortDesc, " & _ "FileName, " & _ "DownloadURL FROM Content" & _ " WHERE " & _ "Content.ContentId = " & to_sql(ContentId,"number") & "" on error resume next set rs = cn.Execute(sql) if err.number <> 0 then b_error = true elseif rs.EOF then b_results = false else Downloads = rs("Downloads") EMail = rs("EMail") ContentId = rs("ContentId") user_id = rs("user_id") CatId = rs("CatId") RelatedURL = rs("RelatedURL") Title = rs("Title") Author = rs("Author") DateAdded = rs("DateAdded") ShortDesc = rs("ShortDesc") FileName = rs("FileName") DownloadURL = rs("DownloadURL") end if rs.Close on error goto 0 end sub sub db_insert_detail_Content sql = "INSERT INTO Content" & _ "(" & _ "Downloads," & _ "EMail," & _ "user_id," & _ "CatId," & _ "RelatedURL," & _ "Title," & _ "Author," & _ "DateAdded," & _ "ShortDesc," & _ "FileName," & _ "DownloadURL" & _ ") VALUES (" & to_sql(Downloads,"number") & "," & _ "" & to_sql(EMail,"text") & "," & _ "" & to_sql(user_id,"number") & "," & _ "" & to_sql(CatId,"number") & "," & _ "" & to_sql(RelatedURL,"text") & "," & _ "" & to_sql(Title,"text") & "," & _ "" & to_sql(Author,"text") & "," & _ "" & to_sql(DateAdded,"text") & "," & _ "" & to_sql(ShortDesc,"text") & "," & _ "" & to_sql(FileName,"text") & "," & _ "" & to_sql(DownloadURL,"text") & ")" & _ "" 'response.write sql on error resume next cn.Execute(sql) if err.Number <> 0 then b_error = true else set rs = cn.Execute("SELECT @@IDENTITY") ContentId = rs(0) rs.Close end if on error goto 0 end sub sub db_update_detail_Content sql = "UPDATE Content SET " & _ "Downloads = " & to_sql(Downloads,"number") & ", " & _ "EMail = " & to_sql(EMail,"text") & ", " & _ "user_id = " & to_sql(user_id,"number") & ", " & _ "CatId = " & to_sql(CatId,"number") & ", " & _ "RelatedURL = " & to_sql(RelatedURL,"text") & ", " & _ "Title = " & to_sql(Title,"text") & ", " & _ "Author = " & to_sql(Author,"text") & ", " & _ "DateAdded = " & to_sql(DateAdded,"text") & ", " & _ "ShortDesc = " & to_sql(ShortDesc,"text") & ", " & _ "FileName = " & to_sql(FileName,"text") & ", " & _ "DownloadURL = " & to_sql(DownloadURL,"text") & " WHERE " & _ "ContentId = " & to_sql(ContentId,"number") & "" 'response.write sql on error resume next cn.execute(sql) if err.number <> 0 then b_error = true end if on error goto 0 end sub sub db_delete_detail_Content sql = "DELETE FROM Content" & _ " WHERE " & _ "ContentId = " & to_sql(ContentId,"number") & "" 'response.write sql on error resume next cn.Execute(sql) if err.number <> 0 then b_error = true end if on error goto 0 end sub sub db_select_view_Content if do_search = "1" then request_view_Content view_Content_sql = "SELECT " & _ "Content.ContentId, " & _ "Content.user_id, " & _ "Content.ContentTypeId, " & _ "Content.CatId, " & _ "Content.FileName, " & _ "Content.RelatedURL, " & _ "Content.DownloadURL, " & _ "Content.Display, " & _ "Content.EMail, " & _ "Content.Expire, " & _ "Content.Priority, " & _ "Content.Impressions, " & _ "Content.ClickThrus, " & _ "Content.Ratings, " & _ "ContentTypes.ContentType, " & _ "Cats.Cat, " & _ "Content.Title, " & _ "Content.Author, " & _ "Content.DateAdded FROM ((Content LEFT JOIN Cats ON Content.catid = Cats.catid)" & _ " LEFT JOIN ContentTypes ON Content.contenttypeid = ContentTypes.contenttypeid)" & _ " WHERE Title LIKE '%" & keywords & "%' OR Author LIKE '%" & keywords & "%' OR FileName LIKE '%" & keywords & "%' OR RelatedURL LIKE '%" & keywords & "%' OR DownloadURL LIKE '%" & keywords & "%' OR EMail LIKE '%" & keywords & "%'" else view_Content_sql = "SELECT " & _ "Content.ContentId, " & _ "Content.user_id, " & _ "Content.ContentTypeId, " & _ "Content.CatId, " & _ "Content.FileName, " & _ "Content.RelatedURL, " & _ "Content.DownloadURL, " & _ "Content.Display, " & _ "Content.EMail, " & _ "Content.Expire, " & _ "Content.Priority, " & _ "Content.Impressions, " & _ "Content.ClickThrus, " & _ "Content.Ratings, " & _ "ContentTypes.ContentType, " & _ "Cats.Cat, " & _ "Content.Title, " & _ "Content.Author, " & _ "Content.DateAdded FROM ((Content LEFT JOIN Cats ON Content.catid = Cats.catid)" & _ " LEFT JOIN ContentTypes ON Content.contenttypeid = ContentTypes.contenttypeid)" & _ " WHERE Content.ContentTypeID=7 AND Display=1" & _ "" end if if request("sortby") <> "" AND inStr(lcase(view_Content_sql),"order by") = 0 then view_Content_sql = view_Content_sql + " ORDER BY " & request("sortby") end sub sub db_delete_view_Content sql = "DELETE FROM Content" & _ " WHERE " & _ "ContentTypeId = " & to_sql(ContentTypeId,"number") & " AND " & _ "CatId = " & to_sql(CatId,"number") & "" 'response.write sql on error resume next cn.Execute(sql) if err.number <> 0 then b_error = true end if on error goto 0 end sub do_search = request("do_search") ''' request form keys and inputs ContentId = request("ContentId") ContentTypeId = request("ContentTypeId") CatId = request("CatId") ''' request action action = lcase(request("action")) ''' action case handler select case action case "select_detail_content" ' select the requested key record from database if ContentId <> "" then db_select_detail_Content else b_error = true error_list.add "edit_detail_Content", "Specify record to select." end if case "insert_detail_content" ' request form data and insert a new record into database validate_detail_content if not b_error then db_insert_detail_content end if case "update_detail_content" ' request form data and update an existing database record validate_detail_content if not b_error then if ContentId <> "" then db_update_detail_content else b_error = true error_list.add "update_detail_content", "Specify record to update." end if end if case "delete_detail_content" ' delete the requested key database record if ContentId <> "" then db_delete_detail_content response.redirect request.servervariables("script_name") & "?msg=The+record+was+deleted." else b_error = true error_list.add "delete_detail_content", "Specify record to delete." end if case "select_view_content" ' select the requested key record from database if ContentTypeId <> "" AND CatId <> "" then db_select_view_Content else b_error = true error_list.add "edit_view_Content", "Specify record to select." end if case "display_detail_Content" display_detail_Content = true end select ':: handle the default case(s) for each form (separate from action= parameter) if ContentId <> "" then db_select_detail_Content display_detail_Content = true end if db_select_view_Content %> <% display_errs display_msg %> <% if inStr(lcase(cn.Provider),"jet") = 0 then '' with SQL db this must be set so that the Category select list displays correctly cn.Execute ("SET CONCAT_NULL_YIELDS_NULL OFF") cc = "+" else '' Access concatentation cc = "&" end if %>
Download Library
<% if session("accesslevel") > 2 then %> <% End If %>
[submit files for library]
Browse 
<% if ContentId <> "" OR display_detail_Content then %> <% ':: check if hide form var was set if not b_hide_detail_Content then %>
Title <% =Title %>
Author <% =Author %>
Submitted <% =DateAdded %>
Description <% =ShortDesc %>
Downloads <% if FileName <> "" then %> <% =Downloads %> [click here to download ] <% else %><% =FileName %><% end if %>
Alternate site <% =DownloadURL %>
<% ':: end hide form if end if %> <%end if%> <% if display_detail_Content <> true then %> <% page_no = request("page_no") if page_no = "" then page_no = 1 if view_Content_sql <> "" then cmd.CommandText = view_Content_sql rs.Filter = "" if CatId <> "" then rs.Filter = "CatId = " & to_sql(CatId,"number") rs.CursorLocation = 3 rs.CacheSize = 5 rs.Open cmd if not rs.EOF then rs.MoveFirst rs.PageSize = 15 max_count = cInt(rs.PageCount) num_recs = rs.RecordCount rs.AbsolutePage = page_no results = true else results = false rs.Close end if else results = false end if rec_count = 0 %> <% if results = true then %> <% do while not rs.EOF AND (rec_count < rs.Pagesize) ':: read db record on error resume next Display = rs("Display") EMail = rs("EMail") Expire = rs("Expire") Priority = rs("Priority") Impressions = rs("Impressions") ClickThrus = rs("ClickThrus") Ratings = rs("Ratings") ContentType = rs("ContentType") ContentId = rs("ContentId") user_id = rs("user_id") ContentTypeId = rs("ContentTypeId") CatId = rs("CatId") DownloadURL = rs("DownloadURL") FileName = rs("FileName") RelatedURL = rs("RelatedURL") Cat = rs("Cat") Title = rs("Title") Author = rs("Author") DateAdded = rs("DateAdded") blank_row = rs("blank_row") on error goto 0 %> <% rs.MoveNext rec_count = rec_count + 1 loop rs.Close %>
Category <% =Cat %>
Title <% =Title %>
Author <% =Author %>
Submitted <% =DateAdded %>

<% =blank_row %>
<% else %> No downloads available. <% end if %> <% if max_count > 1 then %>
<% if page_no > 1 then %> ?<% =request_string %>page_no=<% =page_no-1 %>&sortby=<% =request("sortby") %>">PREV <% else %> <% end if %> Page  <% for i = 1 to max_count %> <% if i = cint(page_no) then %> <%=i%> <% else %> ?<% =request_string %>page_no=<% =i %>&sortby=<% =request("sortby") %>"><%=i%> <% end if %> <%next %> <% if cInt(page_no) < cInt(max_count) then %> ?<% =request_string %>page_no=<% =page_no+1 %>&sortby=<% =request("sortby") %>">NEXT <% end if %>
<% end if %> <%end if%> <% ':: assure that any db resources are freed on error resume next rs.Close set rs = NOTHING cn.Close set cn = NOTHING user_cn.Close set user_cn = NOTHING on error goto 0 %>