<% if Request.QueryString = "" then '********************************************* ' This is the initial search page, basically ' it contains the form and all the info that ' is needed to be passed to the script for ' processing '********************************************* %>

FIND A FRIENDLY CHURCH ONLINE!!

Search by ZIP CODE, or City & State.

Narrow your search by choosing a Denomination or limiting your distance from home


Enter your zip code to search your surrounding area.
You can also enter a specific city, state, and/or denomination to search in a specific area.



City -
State -
Denomination -
Zip Code -
Distance - 5 Miles
10 Miles
<% '****************************************** ' This is the actual seach function ' It converts the distance that a person ' Wishes to find, converts it into latitude ' and longitude, then finds all the churches ' in the surrounding area, pulling them ' from the database, displaying them on ' the screen '****************************************** elseif Request.QueryString("ACTION") = "Search" then if Request.Querystring("zipcode") <> "" then dim Ziplist (500,2) dim ordZipList (500) DiffLat = Request.QueryString("radius") / 69.1 DiffLon = Request.QueryString("radius") / 69.1 strQ = "select * from zipusa where zipcode = '" & Request.QueryString("zipcode") &"';" set objRS = Server.CreateObject("ADODB.RecordSet") set objAddress = Server.CreateObject("ADODB.RecordSet") objRS.Open strQ, "DBQ=" + Server.MapPath("_private/zipcodes.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" if not objRS.EOF then homeLat = objRS("LAT") homeLon = objRS("LNG") end if objRS.Close strQ = "select distinctrow * from zipusa where ((lat between "& homeLat - DiffLat &" and "& homeLat + DiffLat &") AND (" strQ = strQ +"lng between "& homeLon - DiffLon &" AND "& homeLon + DiffLon &"));" objRS.Open strQ, "DBQ=" + Server.MapPath("_private/zipcodes.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" counter = 0 while not objRS.EOF Ziplist(counter,0) = objRS("ZipCode") DistLat = 69.1 * (homeLat - objRS("LAT")) DistLong = 69.1 * (homeLon - objRS("LNG")) * cos(objRS("LAT") / 57.3) Ziplist(counter,1) = (DistLat^2 + DistLong^2)^.5 objRS.Movenext counter = counter + 1 wend objRS.close ' ** Place the zip codes in distance order ** for i = 1 to counter LrgNum = 0 LrgVal = -1 for i2 = 0 to counter-1 if Ziplist (i2,1) >= LrgVal then LrgNum = i2 LrgVal = Ziplist(i2,1) end if next ordZipList(i) = Ziplist(LrgNum,0) Ziplist(LrgNum,1) = -2 next LastZip = ordZipList(1) ' ** Pull the churches in the zip codes out of the database ** strQ = "select * from mlAddress where ((zipcode = '"& ordZipList(1) &"')" for i = 2 to counter if ordZipList(i) <> LastZip then strQ = strQ + " OR (zipcode = '"& ordZipList(i) &"')" LastZip = ordZipList(i) end if next strQ = strQ + ");" objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" if Request.QueryString("Denom") <> "ALL" and not objRS.EOF then strQ = "select * from mlMemberChurches where (((MemberID = "& objRS("MemberID") &")" if not objRS.EOF then objRS.Movenext While not objRS.EOF strQ = strQ + " OR (MemberID ="& objRS("MemberID") &")" objRS.Movenext wend strQ = strQ + ")" strQ = strQ + " AND (Denomination = '"& Request.QueryString("Denom") &"'));" objRS.Close objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" end if If Request.QueryString("city") <> "" and not objRS.EOF then strQ = "select * from mlAddress where (((MemberID = "&objRS("MemberID") &")" if not objRS.EOF then objRS.Movenext While not objRS.EOF strQ = strQ + " OR (MemberID = "&objRS("MemberID") &")" objRS.Movenext wend strQ = strQ + ")" strQ = strQ +" AND (City like '%"& Request.Querystring("city") &"%'));" objRS.Close objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" end if If Request.QueryString("state") <> "Any" and not objRS.EOF then strQ = "select * from mlAddress where (((MemberID = "&objRS("MemberID") &")" if not objRS.EOF then objRS.Movenext While not objRS.EOF strQ = strQ + " OR (MemberID = "&objRS("MemberID") &")" objRS.Movenext wend strQ = strQ + ")" strQ = strQ +" AND (State like '%"& Request.Querystring("state") &"%'));" objRS.Close objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" end if else '***************************************** ' In event that the user does not do a ' Zip code search, you can fall back on ' searching the inidividual databases '***************************************** set objRS = Server.CreateObject("ADODB.Recordset") set objAddress = Server.CreateObject("ADODB.Recordset") if Request.QueryString("Denom") <> "ALL" then strQ = "select * from mlMemberChurches where Denomination = '"&Request.QueryString("Denom") &"';" objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" end if If Request.QueryString("city") <> "" then if Request.QueryString("Denom") = "ALL" then strQ = "select * from mlAddress where (city like '"& Request.Querystring("City") &"');" objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" elseif not objRS.eof then strQ = "select * from mlAddress where (((MemberID = "&objRS("MemberID") &")" if not objRS.EOF then objRS.Movenext While not objRS.EOF strQ = strQ + " OR (MemberID = "&objRS("MemberID") &")" objRS.Movenext wend strQ = strQ + ")" strQ = strQ +" AND (City like '%"& Request.Querystring("city") &"%'));" objRS.Close objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" end if end if If Request.QueryString("state") <> "Any" then if Request.QueryString("Denom") = "ALL" and Request.QueryString("city") = "" then strQ = "select * from mlAddress where state ='"&Request.Querystring("state")&"';" objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" elseif not objRS.eof then strQ = "select * from mlAddress where (((MemberID = "&objRS("MemberID") &")" if not objRS.EOF then objRS.Movenext While not objRS.EOF strQ = strQ + " OR (MemberID = "&objRS("MemberID") &")" objRS.Movenext wend strQ = strQ + ")" strQ = strQ +" AND (City like '%"& Request.Querystring("city") &"%'));" objRS.Close objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" end if end if end if if objRS.Eof then '** If we don't find anything in the database (Zip Code or other Search) Print the error message %>


No Churches Found Matching Your Criteria, Please search again


<% if Request.Querystring("city") <> "" then %>

You may wish to widen your search by entering only your zip code

Retry
<% end if %> <% else '** Otherwise, go ahead and display the churches and their towns strQ = "select * from mlMemberChurches where ((MemberID = "& objRS("MemberID") &")" if not objRS.EOF then objRS.Movenext While not objRS.EOF strQ = strQ + " OR (MemberID ="& objRS("MemberID") &")" objRS.Movenext wend strQ = strQ + ") ORDER BY [Church Name];" objRS.Close objRS.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" '** Generate Query for Addresses on Display Page ** strQ = "select * from mlAddress where ((MemberID = "& objRS("MemberID") &")" if not objRS.EOF then objRS.Movenext While not objRS.EOF strQ = strQ + " OR (MemberID ="& objRS("MemberID") &")" objRS.Movenext wend strQ = strQ + ");" ' ** Reset objRS ** objRS.MoveFirst ' ** Open for address info ** objAddress.Open strQ, "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" %>

FIND A FRIENDLY CHURCH ONLINE!!

Click on the name of the church for more information.



<% While not objRS.EOF Response.Write "" Response.Write "
" & objRS("Church Name") &"" while not objAddress.EOF if ((objAddress("MemberID") = objRS("MemberID")) AND (objAddress("Address Type") = "Church")) then Response.Write objAddress("City") &","& objAddress("State") objAddress.MoveNext wend objAddress.MoveFirst Response.Write "

" objRS.MoveNext wend objRS.close set objRS = nothing objAddress.close set objAddress = nothing Response.Write "
Back
" end if '******************************************* ' This function actually displays the detailed ' info about a church, it has multiple queries ' to different tables, basically narrowing everything ' down in one summary '******************************************* elseif Request.QueryString("ACTION") = "Display" then set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "DBQ=" + Server.MapPath("_private/newver.mdb")+";DefaultDir="+Server.MapPath(".") + ";Driver={Microsoft Access Driver (*.mdb)}" Set objName = Server.CreateObject("ADODB.RecordSet") Set objAddress = Server.CreateObject("ADODB.Recordset") Set objChurchProf = Server.CreateObject("ADODB.Recordset") Set objChurchServ = Server.CreateObject("ADODB.Recordset") Set objPhone = Server.CreateObject("ADODB.Recordset") Set objStaff = Server.CreateObject("ADODB.Recordset") Set objEmail = Server.CreateObject("ADODB.Recordset") strQ = "Select * from mlMemberChurches where MemberID="& Request.Querystring("ID") objName.Open strQ, objConn strQ = "Select * from mlChurchProfile where MemberID="& Request.Querystring("ID") objChurchProf.Open strQ, objConn strQ = "Select * from mlChurchServices where MemberID="& Request.Querystring("ID") objChurchServ.Open strQ, objConn strQ = "Select * from mlAddress where MemberID = "& Request.Querystring("ID") objAddress.Open strQ, objConn strQ = "Select * from [mlPhone Numbers] where ((MemberID = "&Request.Querystring("ID") & ") AND ([Phone Type] = 'Church'));" objPhone.Open strQ, objConn strQ = "Select * from [slStaff List] where ((MemberID = "&Request.Querystring("ID") & ") AND (Title = 'Senior Pastor'));" objStaff.Open strQ, objConn strQ = "Select * from [mlE-Mail Address] where ((MemberID = "&Request.Querystring("ID") & ") AND ([E-Mail Type] = 'Church'));" objEmail.Open strQ, objConn %>

<%= objName("Church Name") %>

<% set objFileSystem = Server.CreateObject("Scripting.FileSystemObject") strFileLocation = Server.MapPath(".") & "\images\"& Request.QueryString("ID") & ".jpg" if objFileSystem.FileExists(strFileLocation) then Response.Write "

" %>

<%= objChurchProf("Church Motto") %>

Church Name -<%= objName("Church Name") %>
Denomination -<%= objName("Denomination") %>
Address -<%= objAddress("Address Line 1") %> Pastor -<%= objStaff("FirstName") %>  <%= objStaff("LastName") %>
City -<%= objAddress("City") %> <% strFileLocation = Server.MapPath(".") & "\images\"& Request.QueryString("ID") & "p.jpg" if objFileSystem.FileExists(strFileLocation) then Response.Write "
" %>
State -<%= objAddress("State") %>
Zip Code -<%= objAddress("ZipCode") %>
Phone -<%= objPhone("Phone Number") %>
E-Mail - <% If not objEmail.EOF then Response.Write objEmail("E-mail Address") end If %>
Web Page -<%= objChurchProf("Website") %> Avg Attendance -<%= objChurchProf("Avg Size") %>
Demographics -<%= objChurchProf("Demographic Makeup") %>
 
<% if objChurchProf("Air Conditioning") = "True" then Response.Write "" else Response.Write "" end if %> Air Conditioned <% if objChurchServ("Nursery") = "True" then Response.Write "" else Response.Write "" end if %> Nursery Provided


<% while not objChurchServ.EOF Response.Write "" Response.Write "" Response.Write "" Response.Write "" objChurchServ.MoveNext Response.Write "
Service Type
Day of the Week
Service Time
Worship Style
"& objChurchServ("Service Type") &"
" & objChurchServ("Day of Week") &"
" & objChurchServ("Service Time") &"
" & objChurchServ("Worship Style") & "

" wend %>


<% Response.Write "Back to List
" Response.Write "New Search" objName.Close set objName = nothing objAddress.Close set objAddress = nothing objChurchProf.Close set objChurchProf = nothing objChurchServ.Close set objChurchServ = nothing objPhone.Close set objPhone = nothing objStaff.Close set objStaff = nothing objEmail.Close set objEmail = nothing objConn.Close set objConn = nothing end if %>

All member churches adhere to our strict and uncompromising Statement of Christian Faith developed in the traditions of historic Biblical Christianity, based solely on the Holy Bible . No matter how we modernize the methods, it is our pledge to maintain the sacred trust given us by maintaining a membership, regardless of denomination, faithful to the principles given by God, upheld by millennia of tradition, rooted ultimately in the Bible alone.



PLEASE TAKE A MOMENT TO READ OUR COMMON
STATEMENT OF FAITH

Call 1-877-OUR-HOPE for a friendly church near you!


MISSION MEDIA MINISTRIES

P.O. Box 507, Horsham, PA   19044

Office: (215) 379-8484 Email: info@877ourhope.org