Author |
Topic |
|
mwatson
Starting Member
United Kingdom
16 Posts |
Posted - 03 June 2011 : 04:35:10
|
Hi, I am trying to have a search feature (similar to admin_member_search.asp, but for members) where members can search for keywords in other members "Quotes" and display all the members with those words in their quotes. (similar to admin_member_search.asp).
I have tried to make a copy of admin_member_search.asp and modify it but no joy. Is thais possible?
The reason is because I have cleverly changed the "Quote" (by means of cut and paste) in members profile to "Services to Other Colleges" where our members put things like: Laminating, Poster printing, Seceterial ect. and we need to be able to seach for members that offer these services.
Many Thanks |
Mark
|
|
Carefree
Advanced Member
Philippines
4207 Posts |
Posted - 03 June 2011 : 14:42:39
|
Not too difficult, I'll write it for you.
Here you go, save as "quotesearch.asp", link however you'd like.
<%
'###############################################################################
'##
'## Snitz Forums 2000 v3.4.07
'##
'###############################################################################
'##
'## Copyright © 2000-09 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## This program is free. You can redistribute and/or modify it under the
'## terms of the GNU General Public License as published by the Free Software
'## Foundation; either version 2 or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000 must remain intact in
'## the scripts and in the HTML output. The "powered by" text/logo with a
'## link back to http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful but
'## WITHOUT ANY WARRANTY; without even an implied warranty of MERCHANTABILITY
'## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
'## for more details.
'##
'## You should have received a copy of the GNU General Public License along
'## with this program; if not, write to:
'##
'## Free Software Foundation, Inc.
'## 59 Temple Place, Suite 330
'## Boston, MA 02111-1307
'##
'## Support can be obtained from our support forums at:
'##
'## http://forum.snitz.com
'##
'## Correspondence and marketing questions can be sent to:
'##
'## manderson@snitz.com
'##
'###############################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<!--#INCLUDE FILE="inc_func_member.asp" -->
<%
if strDBNTUserName = "" then
Err_Msg = "<li>You must be logged in to view the Members List</li>"
Response.Write "<table width=""100%"" border=""0"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" " & getCurrentIcon(strIconFolderOpen,"","") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpenTopic,"","") & " Member Services</font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>" & vbNewLine & _
"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """>There Was A Problem!</font></p>" & vbNewLine & _
"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>You must be logged in to view this page</font></p>" & vbNewLine & _
"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:history.go(-1)"">Back to Forum</a></font></p>" & vbNewLine & _
"<br />" & vbNewLine
WriteFooter
Response.End
end if
Response.Write "<script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
" function ChangePage(fnum){" & vbNewLine & _
" if (fnum == 1) {" & vbNewLine & _
" document.PageNum1.submit();" & vbNewLine & _
" }" & vbNewLine & _
" else {" & vbNewLine & _
" document.PageNum2.submit();" & vbNewLine & _
" }" & vbNewLine & _
" }" & vbNewLine & _
"</script>" & vbNewLine
if trim(chkString(Request("method"),"SQLString")) <> "" then
SortMethod = trim(chkString(Request("method"),"SQLString"))
strSortMethod = "&method=" & SortMethod
strSortMethod2 = "?method=" & SortMethod
end if
SearchQuote = trim(Request("M_QUOTE"))
if SearchQuote = "" then
SearchQuote = trim(Request.Form("M_QUOTE"))
end if
SearchQuoteDisplay = Server.HTMLEncode(SearchQuote)
SearchQuote = chkString(SearchQuote, "sqlstring")
mypage = trim(chkString(request("whichpage"),"SQLString"))
if ((mypage = "") or (IsNumeric(mypage) = FALSE)) then mypage = 1
mypage = cLng(mypage)
If Request.Form("mode") = "Search" then
strSql = "SELECT MEMBER_ID, M_STATUS, M_NAME, M_ALLOWEMAIL, M_EMAIL, M_PMRECEIVE, M_Quote"
strSql2 = " FROM " & strMemberTablePrefix & "MEMBERS WHERE M_QUOTE LIKE '%" & SearchQuote & "%'"
else
strSql = "SELECT MEMBER_ID, M_STATUS, M_NAME, M_ALLOWEMAIL, M_EMAIL, M_PMRECEIVE, M_Quote"
strSql2 = " FROM " & strMemberTablePrefix & "MEMBERS"
end if
select case SortMethod
case "nameasc"
strSql4 = " ORDER BY M_NAME ASC"
case "namedesc"
strSql4 = " ORDER BY M_NAME DESC"
case else
strSql4 = " ORDER BY M_NAME ASC"
end select
if strDBType = "mysql" then
if mypage > 1 then
OffSet = cLng((mypage - 1) * strPageSize)
strSql5 = " LIMIT " & OffSet & ", " & strPageSize & " "
end if
strSql1 = "SELECT COUNT(MEMBER_ID) AS PAGECOUNT "
set rsCount = my_Conn.Execute(strSql1 & strSql2 & strSql3)
iPageTotal = rsCount(0).value
rsCount.close
set rsCount = nothing
if iPageTotal > 0 then
maxpages = (iPageTotal \ strPageSize )
if iPageTotal mod strPageSize <> 0 then
maxpages = maxpages + 1
end if
if iPageTotal < (strPageSize + 1) then
intGetRows = iPageTotal
elseif (mypage * strPageSize) > iPageTotal then
intGetRows = strPageSize - ((mypage * strPageSize) - iPageTotal)
else
intGetRows = strPageSize
end if
else
iPageTotal = 0
maxpages = 0
end if
if iPageTotal > 0 then
set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql & strSql2 & strSql3 & strSql4 & strSql5, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
arrMemberData = rs.GetRows(intGetRows)
iMemberCount = UBound(arrMemberData, 2)
rs.close
set rs = nothing
else
iMemberCount = ""
end if
else
set rs = Server.CreateObject("ADODB.Recordset")
rs.cachesize = strPageSize
rs.open strSql & strSql2 & strSql3 & strSql4, my_Conn, adOpenStatic
If not (rs.EOF or rs.BOF) then
rs.movefirst
rs.pagesize = strPageSize
rs.absolutepage = mypage '**
maxpages = cLng(rs.pagecount)
arrMemberData = rs.GetRows(strPageSize)
iMemberCount = UBound(arrMemberData, 2)
else
iMemberCount = ""
end if
rs.Close
set rs = nothing
end if
Response.Write "<table width=""100%"" border=""0"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" " & getCurrentIcon(strIconFolderOpen,"","") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpenTopic,"","") & " Member Services</font></td>" & vbNewLine & _
" <td align=""right"" valign=""bottom"">" & vbNewLine
if maxpages > 1 then
Response.Write " <table border=""0"" align=""right"">" & vbNewLine & _
" <tr>" & vbNewLine
Call Paging2(1)
Response.Write " </tr>" & vbNewLine & _
" </table>" & vbNewLine
else
Response.Write " " & vbNewLine
end if
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table><br>" & vbNewLine & _
"<table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & vbNewline & _
" <tr>" & vbNewline & _
" <td bgcolor=""" & strPopUpBorderColor & """>" & vbNewline & _
" <table border=""0"" width=""100%"" cellspacing=""1"" cellpadding=""4"">" & vbNewline & _
" <tr>" & vbNewline & _
" <form action=""quotesearch.asp" & strSortMethod2 & """ method=""post"" name=""SearchServices"">" & vbNewline & _
" <input type=""hidden"" name=""mode"" value=""Search"">" & vbNewLine & _
" <td bgcolor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Search:</b> " & vbNewline & _
" <input type=""checkbox"" name=""SearchQuote"" value=""1"""
if SearchQuote <> "" then Response.Write(" checked")
Response.Write ">Services" & vbNewline
Response.Write " </font></td>" & vbNewline & _
" <td bgcolor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>For:</b> " & vbNewline & _
" <input type=""text"" size=""100"" maxlength=""255"" name=""M_QUOTE""></font></td>" & vbNewline & _
" <td bgcolor=""" & strPopUpTableColor & """ align=""center"">" & vbNewline
if strGfxButtons = "1" then
Response.Write " <input src=""" & strImageUrl & "button_go.gif"" alt=""Quick Search"" type=""image"" value=""search"" id=""submit1"" name=""submit1"">" & vbNewline
else
Response.Write " <input type=""submit"" value=""search"" id=""submit1"" name=""submit1"">" & vbNewline
end if
Response.Write " </td>" & vbNewline & _
" </form>" & vbNewline & _
" </tr>" & vbNewline & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" <br />" & vbNewLine & _
" <table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td bgcolor=""" & strTableBorderColor & """>" & vbNewLine & _
" <table border=""0"" width=""100%"" cellspacing=""1"" cellpadding=""3"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""5%"" align=""center"" bgcolor=""" & strPopUpTableColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """> </font></b></td>" & vbNewLine & _
" <td width=""20%"" align=""center"" bgcolor=""" & strPopUpTableColor & """><a href=""quotesearch.asp?" & strNames & "link=sort&mode=search&M_NAME=" & SearchQuote & "&method="
if Request.QueryString("method") = "nameasc" then Response.Write("namedesc") else Response.Write("nameasc")
Response.Write """" & dWStatus("Sort by Member Name") & "><b><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """>Member Name</font></b></a></td>" & vbNewLine & _
" <td width=""65%"" align=""center"" bgcolor=""" & strPopUpTableColor & """><a href=""quotesearch.asp?services""><b><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """>Services</font></b></a></td>" & vbNewLine & _
" <td width=""10%"" align=""center"" bgcolor=""" & strPopUpTableColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """> </font></b></td>" & vbNewLine & _
" </tr>" & vbNewLine
if iMemberCount = "" then
Response.Write " <tr>" & vbNewLine & _
" <td colspan=""4"" bgcolor=""" & strForumCellColor & """ ><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><b>No Members Found</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
else
mMEMBER_ID = 0
mM_STATUS = 1
mM_NAME = 2
mM_ALLOWEMAIL = 3
mM_EMAIL = 4
mM_PMRECEIVE = 5
mM_QUOTE = 6
rec = 1
intI = 0
for iMember = 0 to iMemberCount
if (rec = strPageSize + 1) then exit for
Members_MemberID = arrMemberData(mMEMBER_ID, iMember)
Members_MemberStatus = arrMemberData(mM_STATUS, iMember)
Members_MemberName = arrMemberData(mM_NAME, iMember)
Members_MemberAllowEmail = arrMemberData(mM_ALLOWEMAIL, iMember)
Members_MemberEMail = arrMemberData(mM_EMAIL, iMember)
Members_MemberPMreceive = arrMemberData(mM_PMRECEIVE, iMember)
Members_MemberQuote = arrMemberData(mM_QUOTE, iMember)
if intI = 1 then
CColor = strForumFirstCellColor
else
CColor = strForumCellColor
end if
Response.Write " <tr>" & vbNewLine & _
" <td width=""5%"" bgcolor=""" & CColor & """ align=""center"">" & vbNewLine
If strDBNTUserName <> "" and Members_MemberPMreceive = "1" and strPMStatus = "1" Then
Response.Write " <a href=""privatesend.asp?method=Topic&mname=" & ChkString(Members_MemberName,"display") & """" & dWStatus("Send " & ChkString(Members_MemberName,"display") & " a Private Message") & ">" & getCurrentIcon(strIconPmprivatemessage,"Send " & ChkString(Members_MemberName,"display") & " a Private Message","align=""absmiddle"" hspace=""0""") & "</a>" & vbNewLine
End If
Response.Write "</a>" & vbNewLine
if Members_MemberAllowEmail = 1 and Members_MemberEMail > "" Then
Response.Write "<a href=""pop_mail.asp?id=" & Members_MemberID & """" & dWStatus("Send " & ChkString(Members_MemberName,"display") & " E-Mail") & ">" & getCurrentIcon(strIconEmail, "Send " & ChkString(Members_MemberName,"display") & " E-Mail","align=""absmiddle"" hspace=""0""") & "</a>" & vbNewLine
end if
Response.Write " </td>" & vbNewLine & _
" <td width=""20%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine
if strUseExtendedProfile then
Response.Write " <a href=""pop_profile.asp?mode=display&id=" & Members_MemberID & """ title=""View " & ChkString(Members_MemberName,"display") & "'s Profile""" & dWStatus("View " & ChkString(Members_MemberName,"display") & "'s Profile") & ">"
else
Response.Write " <a href=""JavaScript:openWindow3('pop_profile.asp?mode=display&id=" & Members_MemberID & "')"" title=""View " & ChkString(Members_MemberName,"display") & "'s Profile""" & dWStatus("View " & ChkString(Members_MemberName,"display") & "'s Profile") & ">"
end if
Response.Write ChkString(Members_MemberName,"display") & "</a>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td width=""65%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>" & ChkString(Members_MemberQuote, "display") & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td width=""10%"" bgcolor=""" & CColor & """ align=""center""><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine
if mlev = 4 or (lcase(strNoCookies) = "1") then
if Members_MemberID = intAdminMemberID OR (Members_MemberLevel = 3 AND MemberID <> intAdminMemberID) then
else
if Members_MemberStatus <> 0 then
Response.Write " <a href=""JavaScript:openWindow('pop_lock.asp?mode=Member&MEMBER_ID=" & Members_MemberID & "')""" & dWStatus("Lock Member") & ">" & getCurrentIcon(strIconLock,"Lock Member","hspace=""0""") & "</a>" & vbNewLine
Response.Write " <a href=""JavaScript:openWindow('pop_lock.asp?mode=Zap&MEMBER_ID=" & Members_MemberID & "')""" & dWStatus("Zap Member") & ">" & getCurrentIcon(strIconZap,"Zap Member Profile","hspace=""0""") & "</a>" & vbNewLine
else
Response.Write " <a href=""JavaScript:openWindow('pop_open.asp?mode=Member&MEMBER_ID=" & Members_MemberID & "')""" & dWStatus("Un-Lock Member") & ">" & getCurrentIcon(strIconUnlock,"Un-Lock Member","hspace=""0""") & "</a>" & vbNewLine
end if
end if
if (Members_MemberID = intAdminMemberID and MemberID <> intAdminMemberID) OR (Members_MemberLevel = 3 AND MemberID <> intAdminMemberID AND MemberID <> Members_MemberID) then
else
if strUseExtendedProfile then
Response.Write " <a href=""pop_profile.asp?mode=Modify&ID=" & Members_MemberID & """" & dWStatus("Edit Member") & ">" & getCurrentIcon(strIconPencil,"Edit Member","hspace=""0""") & "</a>" & vbNewLine
else
Response.Write " <a href=""JavaScript:openWindow3('pop_profile.asp?mode=Modify&ID=" & Members_MemberID & "')""" & dWStatus("Edit Member") & ">" & getCurrentIcon(strIconPencil,"Edit Member","hspace=""0""") & "</a>" & vbNewLine
end if
end if
if Members_MemberID = intAdminMemberID OR (Members_MemberLevel = 3 AND MemberID <> intAdminMemberID) then
else
Response.Write " <a href=""JavaScript:openWindow('pop_delete.asp?mode=Member&MEMBER_ID=" & Members_MemberID & "')""" & dWStatus("Delete Member") & ">" & getCurrentIcon(strIconTrashcan,"Delete Member","hspace=""0""") & "</a>" & vbNewLine
end if
Response.Write " </font></b>" & vbNewLine
else
Response.Write " "
end if
Response.Write " </td></tr>" & vbNewLine
rec = rec + 1
intI = 1 - intI
next
end if
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td colspan=""2"">" & vbNewLine
if maxpages > 1 then
Response.Write " <table border=""0"">" & vbNewLine & _
" <tr>" & vbNewLine
Call Paging2(2)
Response.Write " </tr>" & vbNewLine & _
" </table>" & vbNewLine
end if
Response.Write " </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" <br />" & vbNewLine
WriteFooter
Response.End
sub Paging2(fnum)
if maxpages > 1 then
if mypage = "" then
sPageNumber = 1
else
sPageNumber = mypage
end if
if SortMethod = "" then
sMethod = "postsdesc"
else
sMethod = SortMethod
end if
Response.Write(" <form name=""PageNum" & fnum & """ action=""quotesearch.asp"">" & vbNewLine)
if fnum = 1 then
Response.Write(" <td align=""right"" valign=""bottom""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine)
else
Response.Write(" <td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine)
end if
if fnum = 1 then
Response.Write(" <b>Page: </b><select name=""whichpage"" size=""1"" onchange=""ChangePage(" & fnum & ");"">" & vbNewLine)
else
Response.Write(" <b>Members are " & maxpages & " Pages Long: </b><select name=""whichpage"" size=""1"" onchange=""ChangePage(" & fnum & ");"">" & vbNewLine)
end if
for counter = 1 to maxpages
if counter <> cLng(sPageNumber) then
Response.Write " <option value=""" & counter & """>" & counter & "</option>" & vbNewLine
else
Response.Write " <option selected value=""" & counter & """>" & counter & "</option>" & vbNewLine
end if
next
if fnum = 1 then
Response.Write(" </select><b> of " & maxPages & "</b>" & vbNewLine)
else
Response.Write(" </select>" & vbNewLine)
end if
Response.Write(" </font></td>" & vbNewLine)
Response.Write(" </form>" & vbNewLine)
end if
end sub
%>
|
Edited by - Carefree on 03 June 2011 18:11:52 |
|
|
mwatson
Starting Member
United Kingdom
16 Posts |
Posted - 07 June 2011 : 09:34:00
|
Carefree, you are a Legend. Thank You so much! I own you a beer! |
Mark
|
|
|
Carefree
Advanced Member
Philippines
4207 Posts |
Posted - 07 June 2011 : 11:59:58
|
Happy to help. |
|
|
|
Topic |
|
|
|