<% Response.Buffer = true %> <% dim level_ID dim str_title dim str_filename dim str_type dim str_author dim str_author_email dim map_after dim map_before dim nmb_comments dim ranking dim votes dim err_msg dim noConditionsFound dim where_stmt dim nowM dim nowY dim nowMonth dim condition dim maps dim num_results dim order_results dim sortedBy dim detailed dim lvl_pos 'dim page 'dim pagesize 'dim howmanyrecs 'dim howmanyfields 'dim maxpages 'dim maxrecs dim score dim page_end dim totalResults dim downloads 'format todays date nowM = DatePart("m", date) nowMonth = monthname(NowM,true) nowY = DatePart("yyyy",date) 'clear err messages err_msg = "" if Request.QueryString("submitted") then if Request.QueryString("listby") = "" and Request.QueryString("page") = "" then 'not a resort or next page of previous search pullFromForm end if if Request.form("details") = "Search Details" or Request.queryString("detailed") then 'now with pictures and paging detailed = true end if formatQuery 'determine the WHERE conditions for search query formatOrder 'determine the order to be listed in if err_msg = "" then searchLevels 'query DB and write results into an array end if elseif not Request.QueryString("refine") then clearSessions end if %> [ search ] <% if Request.QueryString("submitted") and err_msg = "" then 'display results if detailed then displayDetailedLevels else %> <% displayLevels %>
title file filesize author type - d/load added posts rank votes d/loads
<%=searchButtons%><%=aboutSearch%>
<%end if%> <%else 'display Search Form%> The LvL advanced search is a way to optimise what you are looking for on LvL. You can enter as many (or as few) search conditions as you like.

search tips : search definitions

<%if err_msg <> "" then displayError(2) end if%>
?submitted=true" method="post">
title:  ">
author:  ">
filename:  ">
game type: <%=dropboxTypes%> or game size: <%=dropboxPlayers%>
posted after 1st: <%=list_month_fwd%> <%=list_yearA%>  before end of: <%=list_month_back%> <%=list_yearB%>
No. of comments above: ">  below: ">
No. of votes above: ">  below: ">
ranked above: <%=selectRankUp%>  ranked below: <%=selectRankDown%>
No. of downloads above: ">  below: ">
No. of search results :  <%=selectResults%>
results ordered by:  <%=selectOrder%>
+---------------------

+---------------------
search tips:  * Getting no results? try part of a word only (less is more for author, title and filename), or try fewer search conditions
* You can use '_' as a single letter wild card for author, title or filename.
* Blank or unchanged fields are not searched on so only enter what you *want*.
* You can search for game type or game size (not both) because they search on the same field. If you enter both only type is searched on.
* Non-numeric entries into no. of comments or no. of votes are ignored.

search definitions:
title:  what the level is called
author:  level creator
filename:  name of the download zip file. You do not need to include the .zip extension.
game type:  description of game style eg DM, tourney etc.
game size:  based on the recommended number of players
posted after / before:  the date the level was added to ..::LvL
No. of comments above / below:  the number of comments made about the level
No. of votes above / below:  the number of times people have voted for the level
ranked above / below:  an *average* of all of the votes for a map
No. of downloads above / below:  the number of times a download has been started for the level
No. of search results:  how many results you want returned from the search
results ordered by:  Results sorted by selected field either alphabeticaly or from highest to lowest.
Search List:  Results displayed as text which can be resorted by column headers
Search Details:  Results displayed with screen shots and review. Can page through results using summary groups.
<% %>


<%end if%> <% function formatQuery 'where_stmt = " AND " 'once a condition is found where changes to "" for subsequent conditions 'title if session("str_title") <> "" then condition = " AND (q3a_levels.str_title like '%" & SQLSafe(session("str_title")) & "%')" end if 'filename if session("str_filename") <> "" then session("str_filename") = replace(session("str_filename"), ".zip", "") condition = condition & " AND (q3a_levels.str_filename like '%" & SQLSafe(session("str_filename")) & "%')" end if 'game type if session("map_type") <> "All" then 'Response.Write("
map type [" & session("map_type")& "]") condition = condition & "AND (q3a_levels.str_type like '%" & SQLSafe(session("map_type")) & "%')" 'game size elseif session("map_players") <> "All" then if session("map_players") = "small" then condition = condition & " AND (q3a_levels.str_type like '%tourney%') " &_ "(q3a_levels.or str_type like '%2 %') "&_ "(q3a_levels.or str_type like '%2-3%') "&_ "(q3a_levels.or str_type like '%2-4%') " elseif session("map_players") = "small-medium" then condition = condition & " AND (q3a_levels.str_type like '%2-5%') " &_ "(q3a_levels.or str_type like '%2-6%') " elseif session("map_players") = "medium" then condition = condition & " AND (q3a_levels.str_type like '%2-8%') " &_ "(q3a_levels.or str_type like '%3-5%') "&_ "(q3a_levels.or str_type like '%3-6%') "&_ "(q3a_levels.or str_type like '%3-7%') "&_ "(q3a_levels.or str_type like '%4-6%') "&_ "(q3a_levels.or str_type like '%4-7%') " elseif session("map_players") = "medium-large" then condition = condition & " AND (q3a_levels.str_type like '%3-8%') " &_ "(q3a_levels.or str_type like '%3-10%') "&_ "or (q3a_levels.str_type like '%4-8%') "&_ "or (q3a_levels.str_type like '%4-9%') " elseif session("map_players") = "large" then condition = condition & " AND (q3a_levels.str_type like '%4-10%') " &_ "or (q3a_levels.str_type like '%4-12%') "&_ "or (q3a_levels.str_type like '%4-9%') "&_ "or (q3a_levels.str_type like '%5-10%') "&_ "or (q3a_levels.str_type like '%5-12%') "&_ "or (q3a_levels.str_type like '%6-%') " end if end if 'author name if session("str_author") <> "" then condition = condition & " AND (q3a_levels.str_author like '%" & SQLSafe(session("str_author")) & "%')" end if 'date range map_after = "01/" & session("map_afterM") & "/" & session("after_year") 'format date if Cdate(map_after) > Cdate("01/nov/1999") then 'have selected after date condition = condition & " AND (q3a_levels.datestamp > '" & map_after & "')" end if if (session("map_beforeM") <> nowMonth and session("map_beforeY") <> nowY) and not (session("map_beforeM") = lcase("nov") and session("map_beforeY") = 1999) then 'have selected before date map_before = "01/" & session("map_beforeM") & "/" & session("map_beforeY") map_before = dateAdd("m",1,map_before)'calculate last day of month map_before = dateAdd("d", -1, map_before) condition = condition & " AND (q3a_levels.datestamp < '" & map_before & "')" end if 'ranking range if session("map_rankTop") <> 10 then condition = condition & " AND ((q3a_levels.ranking / q3a_levels.votes) < " & session("map_rankTop") & ")" end if if session("map_rankLow") <> 0 then condition = condition & " AND ((q3a_levels.ranking / q3a_levels.votes) > " & session("map_rankLow") & ")" end if 'comments range session("nmb_comments_above") = strip(session("nmb_comments_above")) if isNumeric(session("nmb_comments_above")) then condition = condition & " AND (q3a_levels.nmb_comments > " & session("nmb_comments_above") & ")" end if session("nmb_comments_below") = strip(session("nmb_comments_below")) if isNumeric(session("nmb_comments_below")) and session("nmb_comments_below") > session("nmb_comments_above") then condition = condition & where_stmt &" AND (q3a_levels.nmb_comments < " & session("nmb_comments_below") & ")" end if 'votes range session("votes_above") = strip(session("votes_above")) if isNumeric(session("votes_above")) then condition = condition & " AND (q3a_levels.votes > " & session("votes_above")& ")" end if session("votes_below") = strip(session("votes_below")) if isNumeric(session("votes_below")) and session("votes_below") > session("votes_above") then condition = condition & " AND (q3a_levels.votes < " & session("votes_below")& ")" end if 'download range session("downloads_above") = strip(session("downloads_above")) if isNumeric(session("downloads_above")) then condition = condition & " AND (q3a_download.num_dload > " & session("downloads_above")& ")" end if session("downloads_below") = strip(session("downloads_below")) if isNumeric(session("downloads_below")) then condition = condition & " AND (q3a_download.num_dload < " & session("downloads_below")& ")" end if 'no conditions found if condition = "" and session("order_results") = "whatever" then 'haven't anything at all err_msg = "You need to enter some search conditions" end if end function function formatOrder if Request.QueryString("listby") <> "" then session("order_results") = Request.QueryString("listby") end if if session("order_results") = "filename" then sortedBy = " order by q3a_levels.str_filename" elseif session("order_results") = "author" then sortedBy = " order by q3a_levels.str_author" elseif session("order_results") = "type" then sortedBy = " order by q3a_levels.str_type" elseif session("order_results") = "date" then sortedBy = " order by q3a_levels.datestamp desc" elseif session("order_results") = "votes" then sortedBy = " order by q3a_levels.votes desc" elseif session("order_results") = "comments" then sortedBy = " order by q3a_levels.nmb_comments desc" elseif session("order_results") = "ranking" then sortedBy = " order by (q3a_levels.ranking / q3a_levels.votes) desc" elseif session("order_results") = "downloads" then sortedBy = " order by q3a_download.num_dload desc" else sortedBy = " order by str_title" end if end function function searchLevels dim mandogCon, mandogRS, mandogQuery set mandogCon = Server.CreateObject("ADODB.Connection") mandogCon.Open(DSN) ' set up the mandogQuery to list the maps by date Desc mandogQuery = "select top " & session("num_results")&_ "q3a_levels.id, q3a_levels.str_title, " &_ "q3a_levels.str_filename, q3a_levels.str_type, " &_ "q3a_levels.str_author, q3a_levels.str_author_email, " &_ "q3a_levels.nmb_comments, q3a_levels.ranking, " &_ "q3a_levels.votes, q3a_levels.datestamp, " if detailed then mandogQuery = mandogQuery & " q3a_levels.txt_review, " end if mandogQuery = mandogQuery & "q3a_download.num_dload, " mandogQuery = mandogQuery & "q3a_levels.wwwsite " mandogQuery = mandogQuery & "FROM q3a_levels INNER JOIN " &_ "q3a_download ON " &_ "q3a_levels.id = q3a_download.level_id " mandogQuery = mandogQuery & "where (q3a_levels.bit_archived = 0) " ' mandogQuery = mandogQuery & "where (q3a_levels.bit_archived = 0) " mandogQuery = mandogQuery & condition mandogQuery = mandogQuery & sortedBy 'Response.Write("mandogQuery = [" & mandogQuery & "]
") set mandogRS = mandogCon.Execute(mandogQuery) if not (mandogRS.EOF) Then maps = mandogRS.getrows() totalResults = ubound(maps,2) 'Response.Write("
total results: " & totalResults) else err_msg = "Your search has returned no results, have a look over the search tips below for some pointers" end if mandogRS.close mandogCon.close end function function displayDetailedLevels dim text_review, comments_to_date, page_start page=Request.QueryString("page") if page = "" then page = 1 page_start = 0 else page_start = Cint(page - 1) * 10 end if page_end = page_start + 9 'don't overun the end of our results if totalResults < page_end then page_end = totalResults end if 'Response.Write("
page_start [" & page_start & "] page_end [" & page_end & "] ubound [" & ubound(maps,2) & "]") for i = page_start to page_end level_ID = maps(0,i) str_title = maps(1,i) str_filename = maps(2,i) str_type = maps(3,i) str_author = maps(4,i) str_author_email = maps(5,i) nmb_comments = maps(6,i) ranking = maps(7, i) votes = maps(8, i) datestamp = maps(9, i) '======== 'work out if there is a non english version of the review if Request.Cookies("lvl")("language") <> "" then if LanguageFileCHK(current_ROOT & "translation\" & Request.Cookies("lvl")("language") & "\" & level_ID & ".txt") then text_review = LanguageFileREAD(current_ROOT & "translation\" & Request.Cookies("lvl")("language") & "\" & level_ID & ".txt") else text_review = maps(10, i) end if else text_review = maps(10, i) end if downloads = maps(11,i) 'wwwsite = maps(12,i) 'filename = mandogRS("str_filename") if Cint(nmb_comments) = 0 then comments_to_date = "none yet" else comments_to_date = nmb_comments end if if not IsNull(ranking) or not IsNull(votes) then score = Cint(ranking) / Cint(votes) else score = 0 votes = "no" end if %> <% if (isnull(maps(12,i))) or (maps(12,i) = "") then 'does the author(s)have a web site? %> <% else %> <% end if %>
+---------------------
|  <%=i+1%> - <%=str_title%> by <%=str_author%> (<%=str_type%>, <%=downloads%> d/loads)
+---------------------
score: <%=Round(score,2)%>/10 after <%=votes%> votes - d/load | .au mirror <%=FileSize2(cdrom_dir & file_dir(str_filename) & "\" & str_filename & ".zip")%> - readme - comments (<%=comments_to_date%>)
 
<%=text_review%>
<%=str_filename%><%=str_filename%>
Authors www site


<% next call PageNavBar end function sub PageNavBar() dim pad, scriptname, counter, tmp_group dim ref pad=" " scriptname=request.servervariables("script_name") %>
<%=searchButtons%>
+---------------------
Summary groups -  <% dim counterend, remainder remainder = totalResults mod 10 counterend = fix(totalResults/10) if remainder <> 0 then counterend = counterend + 1 end if 'Response.Write("
counterend [" & counterend & "]") for counter = 1 to counterend if (cint(counter) < 10) or (cint(counter) > 20) then if (right(cstr(counter),1) = "1") then tmp_group = cstr(counter) & "st" elseif (right(cstr(counter),1) = "2") then tmp_group = cstr(counter) & "nd" elseif (right(cstr(counter),1) = "3") then tmp_group = cstr(counter) & "rd" else tmp_group = cstr(counter) & "th" end if else tmp_group = cstr(counter) & "th" end if 'Response.Write("
counter [" & counter & "] page [" & page & "]") if cstr(counter) <> cstr(page) then ref= pad & "" & tmp_group & "" else ref="" & pad & tmp_group & "" end if response.write(ref) if counter <> counterend then response.write " " end if next %>
<%=aboutSearch%> <% end sub function aboutSearch%>
+---------------------
about the score the ranked score is an *average* of all of the votes for a map
highest possible score is 10
for each map you can only vote once per week, up to a total of 3 times
about the search <%if detailed then%>* Search List: Results displayed as text which can be resorted by column headings. <%else%>* Search Details: Results displayed with screen shots and review. Can page through results using summary groups. <%end if%>
* New Search: Clears all fields
* Refine Search: Go back and add to or alter your entered fields.



<% end function function displayLevels dim scr, bgcolor, download_size, i for i=0 to ubound(maps, 2) if i mod 2 then bgcolor = "" else bgcolor = " bgcolor="& bgcolourCustom &"" end if level_ID = maps(0,i) str_title = maps(1,i) str_filename = maps(2,i) str_type = maps(3,i) str_author = maps(4,i) str_author_email = maps(5,i) nmb_comments = maps(6,i) ranking = maps(7, i) votes = maps(8, i) datestamp = maps(9, i) downloads = maps(10, i) if not IsNull(ranking) or not IsNull(votes) then scr = Cint(ranking) / Cint(votes) else scr = 0 end if if (votes = "") or (IsNull(votes)) then votes = 0 end if 'find out how big the file is in kb download_size = FileSize(cdrom_dir & file_dir(str_filename) & "\" & str_filename & ".zip") %> ><%=str_title%> ><%=str_filename%> ><%=download_size%> ><%=str_author%> ><%=str_type%> ><%=realdateshort(datestamp)%> ><%=nmb_comments%> ><%=Round(scr,2)%> ><%=votes%> ><%=downloads%> <% next end function function displayError(columns) %> <%=err_msg%> <% end function function searchButtons %> <%if detailed then%> <%else%> <%end if%>
Total Results: <%=totalResults + 1%>   Sorted by: <%=session("order_results")%>
?submitted=true&page=1" method="post" id=form1 name=form1>
?submitted=true&page=1" method="post" id=form1 name=form1>
?" method="post" id=form1 name=form1>
?refine=true" method="post" id=form1 name=form1>
<% end function function selectOrder %> <% end function function selectResults %> <% end function function selectRankUp dim i %> <% end function function selectRankDown dim i %> <% end function function dropboxPlayers %> <% end function function dropboxTypes %> <% end function function list_yearA %><% end function function list_yearB %><% end function function list_month_fwd dim m, selected %> <% end function function list_month_back dim m, selected %> <% end function function clearSessions 'Response.Write("
clearing house") session("str_title") = "" session("str_filename") = "" session("str_author") = "" session("map_type") = "" session("map_players") = "" session("map_afterM") = "" session("after_year") = 1999 session("map_beforeM") = "" session("map_beforeY") = 2000 session("nmb_comments_above") = "" session("nmb_comments_below") = "" session("votes_above") = "" session("votes_below") = "" session("downloads_above") = "" session("downloads_below") = "" session("map_rankTop") = 10 session("map_rankLow") = 0 session("num_results") = 50 session("order_results") = "" end function function pullFromForm session("str_title") = trim(Request.Form("str_title")) session("str_filename") = trim(Request.Form("str_filename")) session("str_author") = trim(Request.Form("str_author")) session("map_type") = trim(Request.Form("map_type")) session("map_players") = trim(Request.Form("map_players")) session("map_afterM") = trim(Request.Form("map_afterM")) session("after_year") = trim(Request.Form("after_year")) session("map_beforeM") = trim(Request.Form("map_beforeM")) session("map_beforeY") = trim(Request.Form("map_beforeY")) session("nmb_comments_above") = trim(Request.Form("nmb_comments_above")) session("nmb_comments_below") = trim(Request.Form("nmb_comments_below")) session("votes_above") = trim(Request.Form("votes_above")) session("votes_below") = trim(Request.Form("votes_below")) session("downloads_above") = trim(Request.Form("downloads_above")) session("downloads_below") = trim(Request.Form("downloads_below")) session("map_rankTop") = trim(Request.Form("map_rankTop")) session("map_rankLow") = trim(Request.Form("map_rankLow")) session("num_results") = trim(Request.Form("num_results")) session("order_results") = trim(Request.Form("order_results")) end function function strip(formNum) formNum = replace(formNum," ", "") formNum = replace(formNum,",", "") formNum = replace(formNum,"-", "") strip = formNum end function %>