brute-force changed access to $_GET['key'] to use get_array instead
[plewww.git] / planetlab / persons / test.php
1 <?php
2
3 // $Id$
4
5 // Get session and API handles
6 require_once 'plc_session.php';
7 global $plc, $api, $adm;
8
9 // input 
10 $input = strtolower( get_array($_GET, 'input') );
11 $len = strlen($input);
12
13 // init result
14 $aResults = array();
15
16 // dont query the db on empty input
17 if ($len) {
18   // query db
19   $input .= "%";
20   $persons= $adm->GetPersons( array( "email" => $input ), array("email") );
21   if (count($persons)) {
22     foreach ( $persons as $person ) {
23       $aResults[] = $person['email'];
24     }
25   }
26 }
27
28 header("Content-Type: text/xml");
29
30 echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>
31 <results>";
32 for ($i=0;$i<count($aResults);$i++)
33   echo" <rs>".$aResults[$i]."</rs>";
34
35 echo "
36 </results>
37 ";
38
39 ?>