PHP Error on Object-Oriented File Upload Class #142877
Replies: 2 comments 1 reply
-
@ZeppiPurple we meet again haha The first line of your code appears to have a syntax error due to improper assignment. It seems you're trying to destructure an array returned from list($user_id, $username, $conn) = setUpDatabaseAndValidateSession();
|
Beta Was this translation helpful? Give feedback.
-
Please see this comment for reference to why this discussion was closed and locked. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Body
This is my code
$user_id, 'username' => $username, 'conn' => $conn) = setUpDatabaseAndValidateSession(); header('Content-Type: application/json'); function getSystemStats() { $cpuUsage = sys_getloadavg()[0]; $ramTotalGB = round(shell_exec('free | grep Mem | awk \'{print $2}\'') / 1024 / 1024, 2); $ramUsedGB = round(shell_exec('free | grep Mem | awk \'{print $3}\'') / 1024 / 1024, 2); $ramFreeGB = round(shell_exec('free | grep Mem | awk \'{print $4}\'') / 1024 / 1024, 2); return [ 'cpu' => round($cpuUsage * 100), 'ram' => [ 'total' => $ramTotalGB, 'used' => $ramUsedGB, 'free' => $ramFreeGB ] ]; } echo json_encode(getSystemStats()); createLogbookEntry($user_id, "Retrieved system statistics", $conn); // Logbook entry ?>Guidelines
Beta Was this translation helpful? Give feedback.
All reactions