$alertmessage = '<div class="alert alert-danger" role="alert">HTTP response status: 400<br>This is probably caused by a Unifi controller login failure, please check your credentials in config.php</div>'; } /* get the list of sites managed by the controller (if not already stored in $_SESSION) */ if (!isset($_SESSION['sites'])) { $sites = $unifidata->list_sites(); $_SESSION['sites'] = $sites; } else { $sites = $_SESSION['sites']; } /* get the version of the controller (if not already stored in $_SESSION) */ if (!isset($_SESSION['detected_controller_version'])) { $site_info = $unifidata->stat_sysinfo(); $_SESSION['detected_controller_version'] = $site_info[0]->version; } /* starting timing of session here */ $time_1 = microtime(true); /* select the required call to the Unifi Controller API based on the action selected */ switch ($action) { case 'list_clients': $selection = 'list online clients'; $data = $unifidata->list_clients(); break; case 'stat_allusers':