Manually type a search string in browser?

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/67928?pagenum=1
05 November 2025, 10:42

Topic


Lon2
Manually type a search string in browser?
04 December 2008, 11:57


I searched Snitz and couldn't find a topic on this: I was wondering if it's possible to type a search string directly in my browser's address field to search the forums without using the forum's search form? For example, typing this directly in the browser's address bar:

http://www.website.com/forum/search.asp?forum_ID=4&SearchTerms=word1,word2<

 

Replies ...


MaD2ko0l
04 December 2008, 12:09


i dont think you add search terms..if i remember correctly its to stop a security flaw..correct me if im wrong that may have been for somthing else but im sure they made it this way so that a user cannot exploit anything that may occur via dodgy search terms.<
HuwR
04 December 2008, 12:24


it has always been a POST form rather than a GET, I don't know why it was done the way it was, it has allways been that way.<
Lon2
04 December 2008, 12:50


Thanks for the answers.
<
leatherlips
04 December 2008, 20:48


You can in Google.
For example, in Google's search field type:

Code:
your search terms here site:www.yoursite.com/forum
Google will only search for that term within the URL you specified.
So if I wanted to search for the word concert in my forum I would type:

concert site:www.mangionemagic.com/forum

Here is what the results would show up as in Google.
<
Etymon
04 December 2008, 22:34


Find the line in search.asp that has:

if Request.QueryString("mode") = "DoIt" then

Above that add this:

Code:
if trim(Request.Form("Search")) <> "" then
ThisSearch = Request.Form("Search")
elseif trim(Request.QueryString("Search")) <> "" then
ThisSearch = Request.QueryString("Search")
end if

Change:

if Request.QueryString("mode") = "DoIt" then

To:

if Request.QueryString("mode") = "DoIt" or ThisSearch <> "" then

And, change all instances of:

Request.Form("Search")

To:

ThisSearch

Try your search for one word as:

http://www.mydomain.com/search.asp?search=word1

Try your search for two words as:

http://www.mydomain.com/search.asp?search=word1+word2

Most of all ... have fun! smile<
HuwR
05 December 2008, 01:43


Try your search for two words as:

http://www.mydomain.com/search.asp?search=word1+word2

Most of all ... have fun!
it would work, but would not actually do what Lon2 asked which was to search a particular forum smile<
Etymon
05 December 2008, 04:58


In addition to what I wrote above ...
Below the following:

Code:
if trim(Request.Form("Search")) <> "" then
ThisSearch = Request.Form("Search")
elseif trim(Request.QueryString("Search")) <> "" then
ThisSearch = Request.QueryString("Search")
end if


Add this:

Code:

if trim(Request.Form("Forum")) <> "" then
ThisForum = Request.Form("Forum")
elseif trim(Request.QueryString("Forum")) <> "" then
ThisForum = Request.QueryString("Forum")
end if


And, change all instances of:

Request.Form("Forum")

To:

ThisForum

Try your search for one word as:

http://www.mydomain.com/search.asp?search=word1&forum=1

Try your search for two words as:

http://www.mydomain.com/search.asp?search=word1+word2&forum=1

if the forum id you are querying does not produce results, then try the next forum id.
Above of all ... have much more fun than you were having before! bigsmile <
Etymon
05 December 2008, 05:31


Hey Huw,

If you think this qualifies as a MOD, then after Lon2 gets to have a look at it, would you mind moving the topic over to the MOD Add-on Forum w/Code for others to enjoy as well?
Cheers,

Etymon<
Podge
05 December 2008, 06:22


The ideal thing would be to store the search terms in a string variable (e.g. searchterms) and replace all the Request.Form instances with that variable.
<
Etymon
05 December 2008, 06:32


Isn't that what I did here: smile
Code:
if trim(Request.Form("Search")) <> "" then
ThisSearch = Request.Form("Search")
elseif trim(Request.QueryString("Search")) <> "" then
ThisSearch = Request.QueryString("Search")
end if
<
Podge
05 December 2008, 06:50


I'm an idiot or my brain must be fried.
Do you have a demo anywhere ? <
Etymon
05 December 2008, 07:00


The search terms in the query strings below are for a test topic on our new farm web site. As long as we have a description of our cat sammy listed in a topic, then the search terms in the links below for cat+sammy will query for them. However, in the event that we move or delete the topic about our cat sammy, then try something like milk+goat or web+design ...

To find results in forum id 1 (Albums), try this:
http://www.lawrunfarms.com/search_welcome.asp?search=sammy+cat&forum=1

To find results in forum id 2 (Market Place), try this:
http://www.lawrunfarms.com/search_welcome.asp?search=sammy+cat&forum=2<
AnonJr
05 December 2008, 07:59


Originally posted by Etymon
Isn't that what I did here: smile
Code:
if trim(Request.Form("Search")) <> "" then
ThisSearch = Request.Form("Search")
elseif trim(Request.QueryString("Search")) <> "" then
ThisSearch = Request.QueryString("Search")
end if
Don't forget to properly sanitize the inputs with at least the ChkString function.<
Etymon
05 December 2008, 08:06


Thanks for the suggestion Anon! smile
I was just substituting ThisSearch with what is already in the original code which is Request.Form("Search"). Maybe adding the chkstring where it is needed in search.asp also could be an addition to be considered for 3.4.07 as well.
For chkstring(), are you suggesting SQLString or something other?


<
Lon2
05 December 2008, 10:04


So how would I properly sanitize the inputs with at least the ChkString function?

<
Shaggy
05 December 2008, 10:25


The values from the search form are passed through the chkString function when the SQL statement is being constructed so, if you make the changes exactly as posted above, you won't need to do anything else.
<
AnonJr
05 December 2008, 10:30


Originally posted by Shaggy
The values from the search form are passed through the chkString function when the SQL statement is being constructed so, if you make the changes exactly as posted above, you won't need to do anything else.
I was getting ready to check if they were validated elsewhere, thanks.
Been a little distracted today - I'm getting ready for a little vacation. smile<
© 2000-2021 Snitz™ Communications