remove svn keywords and use %{SCMURL} in spec file
[bootmanager.git] / nodeconfig / boot / getnodeid.php
1 <?php
2
3 //
4 // Returns node ID of requestor
5 //
6 // Mark Huang <mlhuang@cs.princeton.edu>
7 // Copyright (C) 2006 The Trustees of Princeton University
8 //
9
10 // Get admin API handle
11 require_once 'plc_api.php';
12 global $adm;
13
14 if (!empty($_REQUEST['mac_addr'])) {
15   $mac_lower = strtolower(trim($_REQUEST['mac_addr']));
16   $mac_upper = strtoupper(trim($_REQUEST['mac_addr']));
17   $interfaces = $adm->GetInterfaces(array('mac' => array($mac_lower, $mac_upper)));
18 } else {
19   $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR']));
20 }
21
22 if (!empty($interfaces)) {
23   print $interfaces[0]['node_id'];
24 } else {
25   print "-1";
26 }
27
28 ?>