| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,43 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * @copyright 2024 Double Bastion LLC <www.doublebastion.com> |
|
| 4 |
+ * |
|
| 5 |
+ * @author Double Bastion LLC |
|
| 6 |
+ * |
|
| 7 |
+ * @license GNU AGPL version 3 or any later version |
|
| 8 |
+ * |
|
| 9 |
+ * This program is free software; you can redistribute it and/or |
|
| 10 |
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 11 |
+ * License as published by the Free Software Foundation; either |
|
| 12 |
+ * version 3 of the License, or any later version. |
|
| 13 |
+ * |
|
| 14 |
+ * This program is distributed in the hope that it will be useful, |
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 |
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 18 |
+ * |
|
| 19 |
+ * You should have received a copy of the GNU Affero General Public |
|
| 20 |
+ * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 |
+ * |
|
| 22 |
+ */ |
|
| 23 |
+ |
|
| 24 |
+session_start(); |
|
| 25 |
+ |
|
| 26 |
+if ($_SESSION['loggedtorspanel'] == true) {
|
|
| 27 |
+ |
|
| 28 |
+ $int = exec("ip addr | awk '/state UP/ {print $2}' | sed 's/.$//'");
|
|
| 29 |
+ |
|
| 30 |
+ $transmitted = file_get_contents("/sys/class/net/".$int."/statistics/tx_bytes");
|
|
| 31 |
+ $received = file_get_contents("/sys/class/net/".$int."/statistics/rx_bytes");
|
|
| 32 |
+ |
|
| 33 |
+ $netuse = []; |
|
| 34 |
+ $netuse['transmit'] = round(intval($transmitted) / 1024, 2); |
|
| 35 |
+ $netuse['receive'] = round(intval($received) / 1024, 2); |
|
| 36 |
+ |
|
| 37 |
+ echo json_encode($netuse); |
|
| 38 |
+ |
|
| 39 |
+} else {
|
|
| 40 |
+ header("Location: panel-login.php");
|
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+?> |