<% check_security(2) %> <% dim LinkID dim Ratings dim DateAdded dim CatID dim LinkTypeID dim Title dim URL dim DownloadURL dim DownloadFee dim Description dim Email dim Priority dim Impressions dim ClickThrus dim AvgRating dim Display dim edit_links_sql dim Cat dim Site dim Send dim view_links_sql sub request_edit_links ''' request form inputs from this form LinkID = request("LinkID") Ratings = request("Ratings") DateAdded = request("DateAdded") CatID = request("CatID") LinkTypeID = request("LinkTypeID") Title = request("Title") URL = request("URL") DownloadURL = request("DownloadURL") DownloadFee = request("DownloadFee") Description = request("Description") Email = request("Email") Priority = request("Priority") Impressions = request("Impressions") ClickThrus = request("ClickThrus") AvgRating = request("AvgRating") Display = request("Display") end sub sub request_view_links ''' request form inputs from this form Email = request("Email") LinkID = request("LinkID") URL = request("URL") Display = request("Display") Title = request("Title") Cat = request("Cat") Site = request("Site") Send = request("Send") Description = request("Description") DateAdded = request("DateAdded") Priority = request("Priority") AvgRating = request("AvgRating") ClickThrus = request("ClickThrus") Impressions = request("Impressions") end sub sub validate_edit_links ''' request and validate data entered from this form LinkID = trim(request("LinkID")) Ratings = trim(request("Ratings")) DateAdded = trim(request("DateAdded")) if DateAdded <> "" AND (not isdate(DateAdded)) then error_list.add "578175date","Added must be a valid date (MM/DD/YY)." b_error = true end if CatID = trim(request("CatID")) if CatID = "" then error_list.add "578176","Category must be specified." b_error = true end if LinkTypeID = trim(request("LinkTypeID")) if LinkTypeID = "" then error_list.add "578183","Link Type ? must be specified." b_error = true end if Title = trim(request("Title")) if Title = "" then error_list.add "578186","Title must be specified." b_error = true end if URL = trim(request("URL")) if URL = "" then error_list.add "578187","URL must be specified." b_error = true end if DownloadURL = trim(request("DownloadURL")) DownloadFee = trim(request("DownloadFee")) Description = trim(request("Description")) Email = trim(request("Email")) Priority = trim(request("Priority")) Impressions = trim(request("Impressions")) ClickThrus = trim(request("ClickThrus")) AvgRating = trim(request("AvgRating")) Display = trim(request("Display")) end sub sub validate_view_links ''' request and validate data entered from this form Email = trim(request("Email")) LinkID = trim(request("LinkID")) URL = trim(request("URL")) Display = trim(request("Display")) Title = trim(request("Title")) Cat = trim(request("Cat")) Site = trim(request("Site")) Send = trim(request("Send")) Description = trim(request("Description")) DateAdded = trim(request("DateAdded")) if DateAdded <> "" AND (not isdate(DateAdded)) then error_list.add "578192date","Added must be a valid date (MM/DD/YY)." b_error = true end if Priority = trim(request("Priority")) AvgRating = trim(request("AvgRating")) ClickThrus = trim(request("ClickThrus")) Impressions = trim(request("Impressions")) end sub sub get_defaults_edit_links ''' set default values for this form Ratings = 1 DateAdded = "" & now() & "" end sub sub get_defaults_view_links ''' set default values for this form Display = 1 end sub sub db_select_edit_Links sql = "SELECT " & _ "LinkID, " & _ "Ratings, " & _ "DateAdded, " & _ "CatID, " & _ "LinkTypeID, " & _ "Title, " & _ "URL, " & _ "DownloadURL, " & _ "DownloadFee, " & _ "Description, " & _ "Email, " & _ "Priority, " & _ "Impressions, " & _ "ClickThrus, " & _ "AvgRating, " & _ "Display FROM Links" & _ " WHERE " & _ "Links.LinkID = " & to_sql(LinkID,"number") & "" on error resume next set rs = cn.Execute(sql) if err.number <> 0 then b_error = true error_list.add "select_data_edit_Links", "The data selection failed. " & err.description elseif rs.EOF then b_results = false msg_list.add "select_data_edit_Links", "The record was removed from the database." else LinkID = rs("LinkID") Ratings = rs("Ratings") DateAdded = rs("DateAdded") CatID = rs("CatID") LinkTypeID = rs("LinkTypeID") Title = rs("Title") URL = rs("URL") DownloadURL = rs("DownloadURL") DownloadFee = rs("DownloadFee") Description = rs("Description") Email = rs("Email") Priority = rs("Priority") Impressions = rs("Impressions") ClickThrus = rs("ClickThrus") AvgRating = rs("AvgRating") Display = rs("Display") end if rs.Close on error goto 0 end sub sub db_insert_edit_Links sql = "INSERT INTO Links" & _ "(" & _ "Ratings," & _ "DateAdded," & _ "CatID," & _ "LinkTypeID," & _ "Title," & _ "URL," & _ "DownloadURL," & _ "DownloadFee," & _ "Description," & _ "Email," & _ "Priority," & _ "Impressions," & _ "ClickThrus," & _ "AvgRating," & _ "Display" & _ ") VALUES (" & to_sql(Ratings,"number") & "," & _ "" & to_sql(DateAdded,"text") & "," & _ "" & to_sql(CatID,"number") & "," & _ "" & to_sql(LinkTypeID,"number") & "," & _ "" & to_sql(Title,"text") & "," & _ "" & to_sql(URL,"text") & "," & _ "" & to_sql(DownloadURL,"text") & "," & _ "" & to_sql(DownloadFee,"text") & "," & _ "" & to_sql(Description,"text") & "," & _ "" & to_sql(Email,"text") & "," & _ "" & to_sql(Priority,"number") & "," & _ "" & to_sql(Impressions,"number") & "," & _ "" & to_sql(ClickThrus,"number") & "," & _ "" & to_sql(AvgRating,"text") & "," & _ "" & to_sql(Display,"number") & ")" & _ "" 'response.write sql on error resume next cn.Execute(sql) if err.Number <> 0 then b_error = true error_list.add "db_insert_edit_Links" & err.Number ,"The database insert failed. " & err.Description else set rs = cn.Execute("SELECT @@IDENTITY") LinkID = rs(0) rs.Close msg_list.add "db_insert_edit_Links","The database insert was successful." end if on error goto 0 end sub sub db_update_edit_Links sql = "UPDATE Links SET " & _ "Ratings = " & to_sql(Ratings,"number") & ", " & _ "DateAdded = " & to_sql(DateAdded,"text") & ", " & _ "CatID = " & to_sql(CatID,"number") & ", " & _ "LinkTypeID = " & to_sql(LinkTypeID,"number") & ", " & _ "Title = " & to_sql(Title,"text") & ", " & _ "URL = " & to_sql(URL,"text") & ", " & _ "DownloadURL = " & to_sql(DownloadURL,"text") & ", " & _ "DownloadFee = " & to_sql(DownloadFee,"text") & ", " & _ "Description = " & to_sql(Description,"text") & ", " & _ "Email = " & to_sql(Email,"text") & ", " & _ "Priority = " & to_sql(Priority,"number") & ", " & _ "Impressions = " & to_sql(Impressions,"number") & ", " & _ "ClickThrus = " & to_sql(ClickThrus,"number") & ", " & _ "AvgRating = " & to_sql(AvgRating,"text") & ", " & _ "Display = " & to_sql(Display,"number") & " WHERE " & _ "LinkID = " & to_sql(LinkID,"number") & "" 'response.write sql on error resume next cn.execute(sql) if err.number <> 0 then b_error = true error_list.add "db_update_edit_Links" & err.Number ,"The database update failed. " & err.Description else end if on error goto 0 end sub sub db_delete_edit_Links sql = "DELETE FROM Links" & _ " WHERE " & _ "LinkID = " & to_sql(LinkID,"number") & "" 'response.write sql on error resume next cn.Execute(sql) if err.number <> 0 then b_error = true error_list.add "db_delete_edit_Links" & err.Number ,"The database deletion failed. " & err.Description else msg_list.add "db_delete_edit_Links","The record was removed." end if on error goto 0 end sub sub db_select_view_Links view_Links_sql = "SELECT " & _ "AvgRating, " & _ "Cat, " & _ "ClickThrus, " & _ "Links.Description AS Description, " & _ "DownloadURL, " & _ "Email, " & _ "DateAdded, " & _ "Impressions, " & _ "LinkID, " & _ "LinkType, " & _ "Priority, " & _ "Ratings, " & _ "Title, " & _ "Display," & _ "URL FROM Cats, Links, LinkTypes WHERE Cats.CatID=Links.CatID AND Links.LinkTypeID=LinkTypes.LinkTypeID" if request("sortby") <> "" AND inStr(lcase(view_Links_sql),"order by") = 0 then view_Links_sql = view_Links_sql + " ORDER BY " & request("sortby") end sub sub db_update_view_Links sql = "UPDATE Links SET Display = " & to_sql(Display,"number") & " WHERE LinkID = " & LinkID & "" 'response.write sql on error resume next cn.execute(sql) if err.number <> 0 then b_error = true error_list.add "db_update_view_Links" & err.Number ,"The database update failed. " & err.Description else end if on error goto 0 end sub sub db_delete_view_Links sql = "DELETE FROM Links" & _ " WHERE " & _ "LinkID = " & to_sql(LinkID,"number") & "" 'response.write sql on error resume next cn.Execute(sql) if err.number <> 0 then b_error = true error_list.add "db_delete_view_Links" & err.Number ,"The database deletion failed. " & err.Description else msg_list.add "db_delete_view_Links","The record was removed." end if on error goto 0 end sub do_search = request("do_search") ''' request form keys and inputs LinkID = request("LinkID") ''' request action action = lcase(request("action")) ''' action case handler select case action case "select_edit_links" ' select the requested key record from database if LinkID <> "" then db_select_edit_Links else b_error = true error_list.add "edit_edit_Links", "Specify record to select." end if case "insert_edit_links" ' request form data and insert a new record into database validate_edit_links if not b_error then db_insert_edit_links end if case "update_edit_links" ' request form data and update an existing database record validate_edit_links if not b_error then if LinkID <> "" then db_update_edit_links else b_error = true error_list.add "update_edit_links", "Specify record to update." end if end if case "delete_edit_links" ' delete the requested key database record if LinkID <> "" then db_delete_edit_links response.redirect request.servervariables("script_name") & "?msg=The+record+was+deleted." else b_error = true error_list.add "delete_edit_links", "Specify record to delete." end if case "update_view_links"' request form data from edit grid to update existing database records ' this case is only created when a grid form's 'update' property is enabled for i = 1 to request.form("LinkID").count Email = trim(request("Email")(i)) LinkID = trim(request("LinkID")(i)) URL = trim(request("URL")(i)) Display = trim(request("Display_" & i & "")) db_update_view_links next response.redirect request.servervariables("script_name") & "?msg=The+database+was+updated." case "delete_view_links"' request form data from edit grid to delete existing database records ' this case is only created when a grid form's 'update' property is enabled if LinkID <> "" then db_delete_view_links response.redirect request.servervariables("script_name") & "?msg=The+record+was+deleted." else b_error = true error_list.add "delete_view_links", "Specify record to delete." end if end select ':: handle the default case(s) for each form (separate from action= parameter) if LinkID <> "" then ''' select existing record to populate form db_select_edit_links else ''' new record end if db_select_view_links %> <% 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 %> <% ':: check if hide form var was set if not b_hide_edit_Links then %>
Link Manager
update<% else %>insert<%end if %>_edit_Links">
Category select the best category for this resource
Link Type ? select the type of resource
Title enter a title (upto 60 characters)
URL specify the URL, including http://, for the resource
Download URL specify the download URL if any
Minumum Cost (if any)
Description enter a description for this resource (upto 1000 characters). This can include HTML code.
Webmaster Email
Priority <% if not isnull(Priority) then '' if (Priority < 1) AND (not Priority) then Priority = 0 else Priority = 0 end if %> select a priority -- used for ranking display in results list
Impressions # of times the resource has been viewed
Clickthrus # of times the related URL has been visited
Your Rating <% if isnull(AvgRating) then AvgRating = "" %> Select your 1(low) to 10(high) rating for this link.
Display <% if Display = "" then Display = false %> checked<% end if %> name="Display" value="1"> check box to approve this link for display
  <% if LinkID <> "" then %>'"><% end if %> <% if LinkID = "" then %><% end if %> <% if LinkID <> "" then %><% end if %> <% if LinkID <> "" then %><% end if %>  
<% ':: end hide form if end if %> <% page_no = request("page_no") if page_no = "" then page_no = 1 if view_Links_sql <> "" then cmd.CommandText = view_Links_sql rs.Filter = "" rs.CursorLocation = 3 rs.CacheSize = 5 rs.Open cmd if not rs.EOF then rs.MoveFirst rs.PageSize = 50 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 Email = rs("Email") LinkID = rs("LinkID") URL = rs("URL") Display = rs("Display") Title = rs("Title") Cat = rs("Cat") Site = rs("Site") Send = rs("Send") Description = rs("Description") DateAdded = rs("DateAdded") Priority = rs("Priority") AvgRating = rs("AvgRating") ClickThrus = rs("ClickThrus") Impressions = rs("Impressions") on error goto 0 %> <% rs.MoveNext rec_count = rec_count + 1 loop rs.Close %>
?<% =request_string %>page_no=<% =page_no %>&sortby=Display" class=fieldFont title="">Approved ?<% =request_string %>page_no=<% =page_no %>&sortby=Title" class=fieldFont title="">Title ?<% =request_string %>page_no=<% =page_no %>&sortby=Cat" class=fieldFont title="">Category Site Email ?<% =request_string %>page_no=<% =page_no %>&sortby=Description" class=fieldFont title="">Description ?<% =request_string %>page_no=<% =page_no %>&sortby=DateAdded" class=fieldFont title="">Added ?<% =request_string %>page_no=<% =page_no %>&sortby=Priority" class=fieldFont title="">Priority ?<% =request_string %>page_no=<% =page_no %>&sortby=AvgRating" class=fieldFont title="">Rating ?<% =request_string %>page_no=<% =page_no %>&sortby=ClickThrus" class=fieldFont title="">Clicks ?<% =request_string %>page_no=<% =page_no %>&sortby=Impressions" class=fieldFont title="">Views
checked<% end if %> name="Display_<% =rec_count+1 %>" value="<% =1 %>"> <% =Title %> <% =Cat %> [launch]<% =Site %> <% if Email <> "" then %>[send]<% end if %><% =Send %> <% if description <> "" then description = left(server.htmlencode(description),40) %><% =to_html(Description) %>... <% =DateAdded %> <% =Priority %> <% =AvgRating %> <% =ClickThrus %> <% =Impressions %>
<% else %> <% 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 %> <% ':: 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 %>