brute-force changed access to $_GET['key'] to use get_array instead
[plewww.git] / planetlab / nodes / 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   $nodes= $adm->GetNodes( array( "hostname" => $input ), array("hostname") );
21   if (count($nodes)) {
22     foreach ( $nodes as $node ) {
23       $aResults[] = $node['hostname'];
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 ?>