| Junior Photo Gallery |
|
<%
Function LoadHotSpot(mFileName) 'writes the popwindow() code onto the page from the database
on error resume next
Set rs=myConn.Execute("select * from tblBroadsPhotos where filename = '"&mFileName&"'")
response.write "href="&chr(34)&"javascript:PopWindow(photodir+'"
response.write rs("filename")&".jpg','"
response.write rs("title")&"','"
response.write rs("description")&"',"
response.write rs("camera")&"+' - "
response.write rs("resolution")&" - "
response.write rs("datetaken")&"');"&chr(34)
response.write " alt="&chr(34)&rs("description")&chr(34)
response.write " title="&chr(34)&rs("description")&chr(34)
on error goto 0
End Function
Function LoadPanelSpot(mmID) 'writes the PopPanel() code onto the page from the database
on error resume next
Set rs=myConn.Execute("select * from tblBroadsLinks where ID = "&mmID)
response.write "href="&chr(34)&"javascript:PopPanel("
response.write rs("ID")&");"&chr(34)
response.write " alt="&chr(34)&rs("title")&chr(34)
response.write " title="&chr(34)&rs("title")&chr(34)
on error goto 0
End Function
%>
<%
Function StandardDate(mDate)
mDate = CDate(mDate)
StandardDate = Day(mDate) & "/" & Month(mDate) & "/" & Year(mDate)
End Function
Function nz(mData) ' avoid saving null values
If len(mData) = 0 then
nz = " "
Else
nz = mData
End if
End Function
Function ReplaceChar(mChar,mData)
If Instr(mData,chr(mChar)) > 0 Then
DataLength = len(mData)
Pointer = 1
Do While Pointer <= DataLength
Char = Mid(mData,Pointer,1)
If Char = chr(mChar) then
mData = Left(mData,Pointer-1) & " " & Mid(mData,Pointer+1)
End If
Pointer = Pointer + 1
Loop ' next char in string
End If
ReplaceChar = mData
End Function
Function FixApostrophe(mData)
If Instr(mData,"'") > 0 Then
DataLength = len(mData)
Pointer = 1
Do While Pointer <= DataLength
Char = Mid(mData,Pointer,1)
If Char = "'" then
If Mid(mData,Pointer,2) <> "''" then
mData = Left(mData,Pointer) & "'" & Mid(mData,Pointer+1)
Pointer = Pointer + 1
DataLength = DataLength + 1
End If
End If
Pointer = Pointer + 1
Loop ' next char in string
End If
FixApostrophe = mData
End Function
function WriteSelectCodeSingle(mReq,mText)
response.write("")
end function
function WriteSelectCode(mReq,mTag,mText)
response.write("")
end function
Function ReFormatted(Str)
on Error resume next
Str=Replace(Str, CHR(13), "")
Str=Replace(Str, CHR(10) & CHR(10)," ")
Str=Replace(Str, CHR(10), " " & Str & " " End Function Function VetInput(cTestString) ' checks for HTML or profanities in a string ' each 'library!' word is searched for in the string ' if any of the library words are surrounded with text, then the word is passed (eg 'scunthorpe') ' if the word is at the beginning or end of another word, then it is blocked. VetInput = "OK" If (Instr(cTestString,"<") > 0 and Instr(cTestString,"<") > 0) then VetInput = "html" Else Dim aProf,Profanity, Suffix, Prefix,pointer, offset, alphachars aProf = Array("bum","tit","crap","fuck","phuck","tosser","fuk","bollo","cunt","bastard","wank","shit","wank","wog","coon","arse") Profanity = "" alphachars = "abcdefghijklmnopqrstuvwxyzABSDEFGHIJKLMNOPQRSTUVWXYZ" cTestString = " " & cTestString & " " ' insert a space at each end of the string For pointer = 0 To UBound(aProf) - 1 offset = InStr(UCase(cTestString), UCase(aProf(pointer))) If offset > 0 Then Prefix = Mid(cTestString, offset - 1, 1) Suffix = Mid(cTestString, offset + Len(aProf(pointer)), 1) If InStr(alphachars, Prefix) > 0 And InStr(alphachars, Suffix) > 0 Then ' it's embedded in another word, so we'll take a chance Else Profanity = Mid(cTestString, offset, Len(aProf(pointer))) Exit For End If End If Next If Len(Profanity) > 0 Then VetInput = "suspect" 'VetInput = "sorry, your entry contained the word " & Profanity & " and cannot be saved." End If End If End Function %> <%if Request("pageMode") = "add record" then response.redirect("/common/jslide_edit.asp?PageMode=AddNew") end if if len(Request("sets")) > 0 then mSet = Request("sets") else mSet = "" end if if len(Request("searchtext")) > 0 then mSearchtext = Request("searchtext") mSearchtext = ReplaceChar(39,mSearchtext) ' dump the ' chars mSearchtext = ReplaceChar(34,mSearchtext) ' dump the " chars else mSearchtext = "" end if if request("PageMode") = "select all" then mSearchText = "" mSet = "" end if Dim myConn OpenOleConn(datadir&"npc_jphotos.mdb") set RS = Server.CreateObject("ADODB.Recordset") rs.Open "select * from tblPhotos", objConn, 1 rs.movelast mSlideCount = rs.RecordCount rs.close SQLstr = "select * from tblPhotos " if len(mSearchtext) > 0 then SQLstr = SQLstr + " where ((description like '%"+mSearchtext+"%' or keywords like '%"+mSearchtext+"%' or datetaken like '%"+mSearchtext+"%' or title like '%"+mSearchtext+"%'))" if len(mSet) > 0 then SQLstr = SQLstr + " and " end if end if if len(mSet) > 0 then if len(mSearchtext) = 0 then SQLstr = SQLstr + " where " end if SQLstr = SQLstr + " ((description like '%"+mSet+"%' or keywords like '%"+mSet+"%' or datetaken like '%"+mSet+"%' or title like '%"+mSet+"%'))" end if SQLstr = SQLstr + " order by id desc " set rs = Server.CreateObject("ADODB.Recordset") rs.Open SQLstr, objConn, 1 if rs.eof or rs.bof then mSlideSelectionCount = 0 else rs.movelast mSlideSelectionCount = rs.RecordCount rs.movefirst end if %>
|