<%@ Language=VBScript %> <% Option Explicit Response.Buffer = True Response.Expires = 0 %> <% ' ---------------------- ' Variables delaration ' ---------------------- Dim objConnection, objCommand, objRecordset Dim strSearchFilter, strSQL, strSQLCategories, intRecords, strHTMLBlock, blnDoSearch, intCraigWonIt, blnWonIt Dim strUserSearch, strCategoriesSelectHTML, intSearchType, strCompCategoryString, strEndDate ' ---------------------- ' Variables initialisation ' ---------------------- strSearchFilter = Request.QueryString("filter") strSQL = "SELECT fldID, fldName, fldDescription, fldURL, fldEndDate, fldAnswer, fldCraigWonIt FROM tblCompetitions" blnDoSearch = True ' ---------------------- ' Main body ' ---------------------- If strSearchFilter = "" Then ' the user submitted a new search ' check if the user wants to search for text or a category If Request.Form("search2") <> "" Then ' user clicked the search category button intSearchType = 2 strSearchFilter = Request.Form("comp_type") If strSearchFilter = "25" Then Response.Redirect ("http://www.ukwins.co.uk/quickie") Else If strSearchFilter = "" Then blnDoSearch = False strSQL = strSQL & " WHERE fldSectorID1 = " & strSearchFilter & " OR fldSectorID2 = " & strSearchFilter & " OR fldSectorID3 = " & strSearchFilter & " OR fldSectorID4 = " & strSearchFilter End If ElseIf Request.Form("search1") <> "" Then ' search by text intSearchType = 1 strSearchFilter = Request.Form("searchText") If strSearchFilter = "" Then blnDoSearch = False strSQL = strSQL & " WHERE fldDescription like '%" & strSearchFilter & "%'" Else 'first time we hit the page blnDoSearch = False End If Else ' from the QueryString intSearchType = 0 strSQL = strSQL & " WHERE fldName like '" & strSearchFilter & "%'" End If strSQL = strSQL & " ORDER BY fldEndDate, fldName" %> <% ' First the get the list of all the competition categories strSQLCategories = "SELECT fldSectorID, fldSectorDescription FROM tblSectors ORDER BY fldSectorID LIMIT 30" Set objRecordset = objConnection.Execute (strSQLCategories) strCategoriesSelectHTML = strCategoriesSelectHTML & "" strCompCategoryString = objRecordset.Fields("fldSectorDescription") Else strCategoriesSelectHTML = strCategoriesSelectHTML & "" End If objRecordset.Movenext Wend Select Case intSearchType Case "0" strUserSearch = "Results for competitions starting with: " & strSearchFilter & "

" Case "1" strUserSearch = "Results for competitions that include: " & strSearchFilter & "

" Case "2" strUserSearch = "Results for '" & strCompCategoryString & "' competitions:" & "

" End Select Set objRecordset = Nothing If blnDoSearch = "True" Then ' Now do the search for competitions Set objRecordset = objConnection.Execute (strSQL, intRecords) strHTMLBlock = "" strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" & vbCrLf If Not objRecordset.Eof Then While Not objRecordset.EOF strEndDate = objRecordset.Fields("fldEndDate") intCraigWonIt = objRecordset.Fields("fldCraigWonIt") strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" & vbCrLf If intCraigWonIt = "1" Then strHTMLBlock = strHTMLBlock & "" & vbCrLf Else strHTMLBlock = strHTMLBlock & "" & vbCrLf End If If strEndDate = "31/12/2100" Or strEndDate = "12/31/2100" Then strEndDate = "Unknown" If strEndDate < (Date()-2) Then strEndDate = "Closed / Pending" strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" objRecordset.MoveNext WEnd Else strHTMLBlock = strHTMLBlock & "" & vbCrLf strHTMLBlock = strHTMLBlock & "" strHTMLBlock = strHTMLBlock & "" & vbCrLf End If strHTMLBlock = strHTMLBlock & "
Website:Prize Description: Ends:
" & objRecordset.Fields("fldName") & "" & objRecordset.Fields("fldDescription") & " 
" & strEndDate & "
" & horizLine(1) & "
No records founds...
" Set objRecordset = Nothing End If objConnection.close Set objConnection = Nothing %> UK Competition Search Engine from UKwins


Search for the Prize you want:
<% If intSearchType = "1" Then %>
<% Else %>
<% End If %>


Browse Categories:




Send in a competition that's not Listed: - http://www.UKwins.co.uk/submit



<% If blnDoSearch = "True" Then %> <%= strUserSearch %> <%= strHTMLBlock %> <% End If %>