Use the correct max results variable in lib/*/find.php3
[freeradius.git] / dialup_admin / lib / ldap / find.php3
1 <?php
2 require_once('../lib/ldap/functions.php3');
3 $ds=@ldap_connect("$config[ldap_server]");  // must be a valid ldap server!
4 if ($ds) {
5         if (!is_numeric($max))
6                 $max = 10;
7         if ($max > 500)
8                 $max = 10;
9         $r=@da_ldap_bind($ds,$config);
10         if ($search_IN == 'name' || $search_IN == 'ou')
11                 $attr = ($search_IN == 'name') ? 'cn' : 'ou';
12         else if ($search_IN == 'radius'){
13                 require('../lib/ldap/attrmap.php3');
14                 $attr = $attrmap[$radius_attr];
15         }
16         if ($config[ldap_debug] == 'true')
17                 print "<b>DEBUG(LDAP): Search Query: BASE='$config[ldap_base]',FILTER='$attr=*$search*'</b><br>\n";
18         $sr=@ldap_search($ds,"$config[ldap_base]", "$attr=*$search*",array('uid'),0,$max);
19         if (($info = @ldap_get_entries($ds, $sr))){
20                 for ($i = 0; $i < $info["count"]; $i++)
21                         $found_users[] = $info[$i]['uid'][0];
22         }
23         @ldap_close($ds);
24 }
25 else
26         echo "<b>Could not connect to the LDAP server</b><br>\n";
27 ?>