[htdig3-dev] htsearch minimum check for matchesperpage variable


Gabriele Bartolini (g.bartol@comune.prato.it)
Thu, 01 Apr 1999 11:08:21 +0200


Ciao diggers ...

Here is a little patch for htsearch. In fact to check the value of
matchesperpage I had to insert a javascript inside my form. Else, if user
would have inserted a non int value (or non positive value), htsearch would
have crashed.

With this minimal control, we check for a valid positive value of it.

This is my propose: any Idea?

Ciao a tutti
e Buona Pasqua

(Ciao to all of you and have a happy Easter)

-Gabriele

Here is the code:

--- htsearch.cc.old Thu Apr 1 11:03:14 1999
+++ htsearch.cc Thu Apr 1 11:04:04 1999
@@ -157,8 +157,14 @@ main(int ac, char **av)
         config.Add("match_method", input["method"]);
     if (input.exists("format"))
         config.Add("template_name", input["format"]);
+
     if (input.exists("matchesperpage"))
- config.Add("matches_per_page", input["matchesperpage"]);
+ {
+ // minimum check for a valid int value of "matchesperpage" cgi variable
+ if(atoi(input["matchesperpage"])>0)
+ config.Add("matches_per_page", input["matchesperpage"]);
+ }
+
     if (input.exists("page"))
         pageNumber = atoi(input["page"]);
     if (input.exists("config"))

>>>>

Did you know Prato is Roberto Benigni's hometown?
Well ... now you know it ...
Oopps ... That's just where I come from. :-))
Thanks Roberto !!!

<<<<

-------------------------------------------------

Gabriele Bartolini
U.O. Rete Civica - Comune di Prato
Prato - Italia - Europa

e-mail: g.bartol@comune.prato.it
http://www.po-net.prato.it

-------------------------------------------------
------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
htdig3-dev@htdig.org containing the single word "unsubscribe" in
the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Thu Apr 01 1999 - 01:29:02 PST