<%@ CodePage=65001 %> <% Const EW_PAGE_ID = "blobview" %> <% Session.Timeout = 100 %> <% Response.Expires = 0 Response.ExpiresAbsolute = Now() - 1 Response.AddHeader "pragma", "no-cache" Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate" %> <% ' Open connection to the database Dim conn Set conn = Server.CreateObject("ADODB.Connection") conn.Open EW_DB_CONNECTION_STRING %> <% Dim Security Set Security = New cAdvancedSecurity %> <% If Not Security.IsLoggedIn() Then Call Security.AutoLogin() If Not Security.IsLoggedIn() Then Call Security.SaveLastUrl() Call Page_Terminate("login.asp") End If %> <% Dim sFilter, objBinary Response.Buffer = True ' Get key If Request.QueryString("ID").Count > 0 Then Coaches.ID.QueryStringValue = Request.QueryString("ID") Else Call Page_Terminate("") ' Exit End If Set objBinary = New cUpload ' Show thumbnail Dim bShowThumbnail, iThumbnailWidth, iThumbnailHeight, iInterpolation bShowThumbnail = (Request.QueryString("showthumbnail") = "1") If Request.QueryString("thumbnailwidth").Count <= 0 And Request.QueryString("thumbnailheight").Count <= 0 Then iThumbnailWidth = EW_THUMBNAIL_DEFAULT_WIDTH ' Set default width iThumbnailHeight = EW_THUMBNAIL_DEFAULT_HEIGHT ' Set default height Else If Request.QueryString("thumbnailwidth").Count > 0 Then iThumbnailWidth = Request.QueryString("thumbnailwidth") If Not IsNumeric(iThumbnailWidth) Or iThumbnailWidth < 0 Then iThumbnailWidth = 0 End If If Request.QueryString("thumbnailheight").Count > 0 Then iThumbnailHeight = Request.QueryString("thumbnailheight") If Not IsNumeric(iThumbnailHeight) Or iThumbnailHeight < 0 Then iThumbnailHeight = 0 End If End If If Request.QueryString("interpolation").Count > 0 Then iInterpolation = Request.QueryString("interpolation") If Not IsNumeric(iInterpolation) Or iInterpolation < 0 Or iInterpolation > 2 Then iInterpolation = 1 ' Set Default Else iInterpolation = 1 End If sFilter = Coaches.SqlKeyFilter If Not IsNumeric(Coaches.ID.QueryStringValue) Then sFilter = "0=1" ' Prevent sql injection End If sFilter = Replace(sFilter, "@ID@", ew_AdjustSql(Coaches.ID.CurrentValue)) ' Set up filter (Sql Where Clause) and get Return Sql ' Sql constructor in Coaches class, Coachesinfo.asp Dim sSql, rs Coaches.CurrentFilter = sFilter sSql = Coaches.SQL Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sSql, conn If Not rs.Eof Then 'rs.MoveFirst Response.ContentType = "image/bmp" objBinary.Value = rs("Picture").Value If bShowThumbnail Then Call objBinary.Resize(iThumbnailWidth, iThumbnailHeight, iInterpolation) End If Response.BinaryWrite objBinary.Value End If rs.Close Set rs = Nothing Set objBinary = Nothing %> <% ' If control is passed here, simply terminate the page without redirect Call Page_Terminate("") ' ----------------------------------------------------------------- ' Subroutine Page_Terminate ' - called when exit page ' - clean up ADO connection and objects ' - if url specified, redirect to url, otherwise end response ' Sub Page_Terminate(url) conn.Close ' Close Connection Set conn = Nothing Set Security = Nothing ' Go to url if specified If url <> "" Then Response.Clear Response.Redirect url End If ' Terminate response Response.End End Sub ' ' Subroutine Page_Terminate (End) ' ---------------------------------------- %> <% %>