switch ($_POST['action']) { case 'Add user': $storage->add_device($_POST['device_id'], $_POST['key']); break; case 'Remove': $storage->remove_device($_POST['device_id'], $_POST['key']); break; default: throw new unknown_action_exception('Unknown action "' . $_POST['action'] . '"'); break; } $storage->stop(); header('Location: ' . $_SERVER['REQUEST_URI'], true, 303); die; } $devices = $storage->get_devices(); $storage->stop(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset=utf-8> <title>Users</title> </head> <body> <h1>Users</h1> <h2>Current users</h2> <table> <tr> <th>Device</th> <th>Key</th>