#43 Search For IP on Any Field (including template table)

closed
nobody
5
2008-12-30
2007-11-15
Anonymous
No

To help find ip addresses, I thought it would be nice to have a feature where you can search any attributes of an ip address(subnet). I looked through the PHP code and noticed that this was already there, but commented out. It didn't work when I uncommented it, but that was only because the additional information ( template ) table was missing in the from clause of the query.

Here is a diff of the two files I changed with version 4.85. I think it would be nice if you added this functionality, as I think it will perform reasonably for 99% of the users of IpPlan. You might need a million IPs before it would really affect performance ( however I have not tested this ). I left the debug code commented out, in case you want to use it. Note that I only tested this on Mysql 5.0.x.

diff ORIGINAL/user/searchallform.php MYCHANGE/user/searchallform.php
82c82,83
< $lst=array("userinf"=>my_("User"),
---
> $lst=array("any"=>my_("Any"),
> "userinf"=>my_("User"),

diff ORIGINAL/user/searchall.php MYCHANGE/user/searchall.php
98c98,100
< /* if ($field == "any") {
---
>
> if ($field == "any") {
> $addtables=", ipaddradd";
104c106
< $where.=" OR (ipaddr.ipaddr=ipaddradd.ipaddr AND
---
> $where.=" OR (ipaddr.ipaddr=ipaddradd.ipaddr AND ipaddr.baseindex = ipaddradd.baseindex AND
107c109
< else */
---
> else
134d135
< /*
135a137
> $addtables=", ipaddradd";
144c146
< else */
---
> else
168d169
< /*
169a171
> $addtables=", ipaddradd";
178c180
< else */
---
> else
248d249
<
267c268,277
<
---
> //printf("<pre>SELECT ipaddr.userinf, ipaddr.location,
> // ipaddr.telno, ipaddr.descrip, %s AS lastmod,
> // ipaddr.ipaddr AS baseaddr, ipaddr.baseindex,
> // ipaddr.hname,
> // customer.custdescrip, customer.customer
> // FROM ipaddr, base, customer %s
> // %s AND
> // base.customer = customer.customer AND
> // base.baseindex = ipaddr.baseindex AND
> // base.baseaddr BETWEEN %s AND %s</pre>",$sqllastmod,$addtables,$where,$startnum,$endnum);
274d283
<

-Scot Hale

Discussion

  • Logged In: NO

    Okay, so I tried this query with about 1800 IPs and performs horribly. If I come up with a good query for doing an any search I will send it your way. With the query as is this feature request shouldn't be implemented.

    -Scot Hale

     
  • Logged In: YES
    user_id=230197
    Originator: NO

    Thanks. If you submit a patch via SF, please attach as a file. Pasting into the tracker page messes up the diff which makes it impossible to apply the patch. I will not apply this patch due to the performance issues mentioned.

     
  • Will introduce serious performance issues.

     
    • status: open --> closed
     
  • Will introduce serious performance issues.