3 // Deprecated. Node Manager manages the node bandwidth limit.
5 // Mark Huang <mlhuang@cs.princeton.edu>
6 // Copyright (C) 2006 The Trustees of Princeton University
11 // Get admin API handle
12 require_once 'plc_api.php';
16 $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR']));
17 if (!empty($interfaces)) {
18 if ($interfaces[0]['bwlimit'] !== NULL) {
19 $rate = $interfaces[0]['bwlimit'];
20 if ($rate >= 1000000000 && ($rate % 1000000000) == 0) {
21 printf("%.0fgbit", ($rate / 1000000000.));
22 } elseif ($rate >= 1000000 && ($rate % 1000000) == 0) {
23 printf("%.0fmbit", ($rate / 1000000.));
24 } elseif ($rate >= 1000) {
25 printf("%.0fkbit", ($rate / 1000.));
27 printf("%.0fbit", $rate);