<% Dim sConnection Dim oConnection Dim oRS Dim ser Dim dname Dim username Dim password Dim sql_string Dim class_sql Dim sail_sql Dim disc_sql dim sail_no dim fname Dim dvalue Dim tvalue Dim i Dim l Dim t Dim dig Dim image_no Dim image_value Dim total_value Dim order_no image_no = 1 image_value = 0 total_value = 0 order_no = 0 DIM search_sail_no search_sail_no = Request.QueryString("search_sail_no") DIM search_class search_class = Request.QueryString("search_class") DIM search_event search_event = Request.QueryString("search_event") DIM search_disc search_disc = Request.QueryString("search_disc") DIM left_class left_class = Request.QueryString("left_class") DIM right_class right_class = Request.QueryString("right_class") DIM left_event left_event = Request.QueryString("left_event") DIM right_event right_event = Request.QueryString("right_event") DIM time_stamp time_stamp = Request.QueryString("time_stamp") Dim Filename FileName = Request.QueryString("Filename") Dim Filenameurl Dim Order Order = Request.QueryString("Order") Dim Paid_action Paid_action = Request.QueryString("Paid") Dim url_query url_query = Request.QueryString Dim full_url full_url = "http://www.againsttheelements.co.uk/IMDB.asp?" & url_query ser = "10.168.1.47" dname = "againstt1_images" username = "againstt1_select" password = "select" sConnection = "DRIVER={MySQL ODBC 5.3 Unicode Driver}; SERVER=" & ser & "; database=" & dname & "; uid=" & username & ";pwd=" & password & ";" Set oConnection = Server.CreateObject("ADODB.Connection") oConnection.Open(sConnection) %>

             

   Professional photographers of outdoor adventure sports
   © Against The Elements   About us
<% If order = "" Then %>

<% if search_disc = "Sailing" then response.write "" response.write "" elseif search_disc = "Other" then response.write "" response.write "" end if %> <% disc_sql = "Select event From images Where event > """" and event_type = """ & search_disc & """ Group by event Order by Year Desc, event" Set oRS = oConnection.Execute(disc_sql) While Not oRS.EOF if oRS.fields("event") = search_event Then response.write "" else response.write "" end if oRS.MoveNext Wend oRS.Close Set oRS = Nothing %>
<% if search_disc = "Sailing" then response.write "" elseif search_disc = "Rallying" then response.write "" elseif search_disc = "Other" then response.write "" Else response.write "" end if %> <% if search_disc = "Sailing" then response.write "" elseif search_disc = "Other" then response.write "" end if %> <% If search_event = "None selected" or search_event = "" Then class_sql = "Select class From images Where class > """" and event_type = """ & search_disc & """and class <>""NULL"" Group by class" else class_sql = "Select class From images Where class > """" and event = """ & search_event & """and class <>""NULL"" Group by class" end if Set oRS = oConnection.Execute(class_sql) While Not oRS.EOF if oRS.fields("class") = search_class Then response.write "" else response.write "" end if oRS.MoveNext Wend oRS.Close Set oRS = Nothing %>
<% if search_disc = "Sailing" then response.write "" elseif search_disc = "Rallying" then response.write "" elseif search_disc = "Other" then response.write "" Else response.write "" end if %> <% if search_disc = "Sailing" then response.write "" elseif search_disc = "Other" then response.write "" end if %> <% If search_event = "None selected" or search_event = "" Then If search_class = "None selected" or search_class = "" Then sail_sql = "Select sail_no From images Where sail_no > """" and event_type = """ & search_disc & """ and sail_no <>""NULL"" Group by sail_no" else sail_sql = "Select sail_no From images Where sail_no > """" and class = """ & search_class & """ and sail_no <>""NULL"" Group by sail_no" end if else If search_class = "None selected" or search_class = "" Then sail_sql = "Select sail_no From images Where sail_no > """" and event = """ & search_event & """ and sail_no <>""NULL"" Group by sail_no" else sail_sql = "Select sail_no From images Where sail_no > """" and event = """ & search_event & """ and class = """ & search_class & """ and sail_no <>""NULL"" Group by sail_no" end if end if Set oRS = oConnection.Execute(sail_sql) While Not oRS.EOF if oRS.fields("sail_no") = search_sail_no Then response.write "" else response.write "" end if oRS.MoveNext Wend oRS.Close Set oRS = Nothing %>
<% End if %> <% DIM search_no search_no = 0 DIM select_no select_no = 1 If search_class = "None selected" or search_class = "" Then else IF search_no = 0 then sql_string = "Where class = """ & search_class & """" search_no = 1 select_no = 1 else sql_string = sql_string & " AND class = """ & search_class & """" select_no = 1 end if End If If search_event = "None selected" or search_event = "" Then else IF search_no = 0 then sql_string = "Where Event = """ & search_event & """" search_no = 1 select_no = 2 else sql_string = sql_string & " AND Event = """ & search_event & """" select_no = 2 end if End If If search_sail_no = "None selected" or search_sail_no = "" Then else IF search_no = 0 then sql_string = "Where sail_no = """ & search_sail_no & """" search_no = 1 select_no = 1 else sql_string = sql_string & " AND sail_no = """ & search_sail_no & """" select_no = 1 end if End If If search_no = 0 then sql_string = "SELECT * FROM images WHERE class = ""me""" else if select_no = 1 then sql_string = "SELECT * FROM images " & sql_string & " Order by Time_stamp desc" else sql_string = "SELECT * FROM images " & sql_string & " Order by Time_stamp asc LIMIT 20" end if End if If Filename = "" Then else dig = 0 sql_string = "" a=Split(Filename,", ") for each x in a sql_string = sql_string & " OR Filename = """ & x & """" dig = dig + 1 Filenameurl = Filenameurl & "&Filename=" & x next a=len(sql_string) sql_string="SELECT * FROM images Where " & right(sql_string,a-3) dig = Len(Filenameurl) -1 Filenameurl = right(Filenameurl,dig) end if If left_class=1 Then sql_string = "SELECT * FROM (SELECT * FROM images WHERE class = """ & search_class & """ AND Time_stamp <= '" & time_stamp & "' ORDER BY Time_stamp DESC LIMIT 8) AS TSQL ORDER BY Time_stamp ASC" end if If right_class=1 Then sql_string = "SELECT * FROM (SELECT * FROM images WHERE class = """ & search_class & """ AND Time_stamp >= '" & time_stamp & "' ORDER BY Time_stamp ASC LIMIT 8) AS TSQL ORDER BY Time_stamp ASC" end if If left_event=1 Then sql_string = "SELECT * FROM (SELECT * FROM images WHERE Event = """ & search_event & """ AND Time_stamp <= '" & time_stamp & "' ORDER BY Time_stamp DESC LIMIT 8) AS TSQL ORDER BY Time_stamp ASC" end if If right_event=1 Then sql_string = "SELECT * FROM (SELECT * FROM images WHERE Event = """ & search_event & """ AND Time_stamp >= '" & time_stamp & "' ORDER BY Time_stamp ASC LIMIT 8) AS TSQL ORDER BY Time_stamp ASC" end if Set oRS = oConnection.Execute(sql_string) If oRS.EOF = True Then If search_no = 1 then response.write "
We have no images matching that criteria. Please make a new selection.
" else response.write "
Thank you for visiting our online image database.

Using the options above you can search our database. Whilst we specialise in Rallying and Sailing photography, you will also find a selection of other events. You can narrow down your selection using the additional drop down lists.
" end if Else If order="" then response.write "
To view an enlarged version click on the picture. Online you can purchase full-size digital copies for your own personal use. Please note resetting the filters clears the shopping basket.
" else response.write "
Online you can purchase a full size digital copy for your personal use. For a commercial license please contact us.
" end if response.write "
" response.write "
" response.write "
" While Not oRS.EOF response.write "
" response.write "
" response.write "
" response.write "" response.write "
" response.write "
" response.write "" image_value = oRS.fields("image_value") If Order = "" Then d = oRS.fields("Time_stamp") dvalue = DatePart("yyyy",d) & "-" & DatePart("m",d) & "-" & DatePart("d",d) & " " & DatePart("h",d) & ":" & DatePart("n",d) & ":" & DatePart("s",d) response.write "
" if image_value > 0 then If Filename = "" Then response.write "  £" & oRS.fields("image_value") & "  
" else response.write "Buy
" end if else response.write "Available by email
" end if response.write "
Searchable keywords:
" if oRS.fields("Event") <> "" Then response.write " " & oRS.fields("Event") & "" Else response.write "
" end if response.write "
" if oRS.fields("class") <> "" Then if oRS.fields("class") = "NULL" Then else response.write " " & oRS.fields("class") & "" end if Else End if response.write "
" If oRS.fields("sail_no") <> "" then If oRS.fields("sail_no") = "NULL" then response.write "
" else response.write " " & oRS.fields("sail_no") & "" end if Else response.write "
" End if Else response.write "
" response.write "
" total_value = total_value + image_value End if response.write "" sail_no = oRS.fields("sail_no") fname = oRS.fields("Filename") image_no = image_no + 1 oRS.MoveNext Wend Set oRS = Nothing If order="" then else End if response.write "" If order="" then response.write "
" response.write "
" response.write "
0
" response.write "
" response.write "
" response.write "
" response.write "
" else image_no = image_no - 1 order_no = image_no dim disc_value dim disc_value_net response.write "
" if image_no = 1 then disc_value_net = FormatNumber((round((total_value),2)),2) response.write "
Your order:
" & image_no & " image selected at a price of £" & disc_value_net & ".
Payment is processed via PayPal and the image will be sent to you automatically using the email address you provide to PayPal. Please choose a payment option below.
" elseif image_no = 2 then disc_value = total_value * 0.20 disc_value_net = FormatNumber((round((total_value - disc_value),2)),2) response.write "
Your order:
" & image_no & " images selected at a total price of £" & disc_value_net & " (discount applied).
Payment is processed via PayPal and the images will be sent to you automatically using the email address you provide to PayPal. Please choose a payment option below.
" else disc_value = total_value * 0.25 disc_value_net = FormatNumber((round((total_value - disc_value),2)),2) response.write "
Your order:
" & image_no & " images selected at a total price of £" & disc_value_net & " (discount applied).
Payment is processed via PayPal and the images will be sent to you automatically using the email address you provide to PayPal. Please choose a payment option below.
" end if response.write "" response.write "
" response.write "
" response.write "
" response.write "
" & image_no & "
" response.write "
" & disc_value_net & "
" response.write "
" response.write "
" response.write "
" End If End If %> <% if order<>"" then if image_no = 1 then if sail_no <> "" then dim addsql addsql = "Select * From images Where sail_no = """ & sail_no & """ and Filename <> """ & fname & """ ORDER BY Time_stamp DESC" Set oRS = oConnection.Execute(addsql) If oRS.EOF = True Then else Dim add_no add_no = 1 response.write "
You may also like... (Discounts: 20% off if you order 2 images; 25% off for 3 or more images)
" response.write "
" response.write "
" While Not oRS.EOF response.write "
" response.write "
" response.write "
" response.write "" response.write "
" response.write "
" response.write "" response.write "
" if oRS.fields("image_value") > 0 then response.write "  £" & oRS.fields("image_value") & "  
" else response.write "Available by email
" end if response.write "
" oRS.MoveNext add_no = add_no + 1 Wend response.write "
" response.write "" end if Set oRS = Nothing end if end if end if response.write "" oConnection.Close %> <% function curPageURL() dim s, protocol, port if Request.ServerVariables("HTTPS") = "on" then s = "s" else s = "" end if protocol = strleft(LCase(Request.ServerVariables("SERVER_PROTOCOL")), "/") & s if Request.ServerVariables("SERVER_PORT") = "80" then port = "" else port = ":" & Request.ServerVariables("SERVER_PORT") end if curPageURL = protocol & "://" & Request.ServerVariables("SERVER_NAME") &_ port & Request.ServerVariables("SCRIPT_NAME") end function function strLeft(str1,str2) strLeft = Left(str1,InStr(str1,str2)-1) end function %>