if (DEBUG) { $fd = fopen('debug.txt', 'a'); fwrite($fd, print_r($_POST, true)); fwrite($fd, print_r($_FILES, true)); fwrite($fd, print_r($debug_msgs, true)); fclose($fd); } $response = new response(); switch ($cmd) { case 'login': login($_POST['uname'], $_POST['password']); break; case 'fetch-albums': list_albums(); break; case 'fetch-album-images': list_images($_POST['set_albumName']); break; case 'add-item': add_image($_POST['set_albumName'], $_FILES['userfile']['name'], $_POST['caption']); break; case 'new-album': // There is a title field as well, but since Plogger doesn't use it, we drop it gr_add_album($_POST['set_albumName'], $_POST['newAlbumTitle'], $_POST['newAlbumDesc']); break; default: $response->set_key('status', GR_STAT_UNKNOWN_CMD); $response->set_key('status_text', 'Unknown command.'); } $response->write(); close_db();
$cmd = isset($_POST["cmd"]) ? $_POST["cmd"] : ""; if (DEBUG) { $fd = fopen("debug.txt", "a"); fwrite($fd, print_r($_POST, true)); fwrite($fd, print_r($_FILES, true)); fwrite($fd, print_r($debug_msgs, true)); fclose($fd); } $response = new response(); switch ($cmd) { case "login": login($_POST["uname"], $_POST["password"]); break; case "fetch-albums": list_albums(); break; case "fetch-album-images": list_images($_POST["set_albumName"]); break; case "add-item": add_image($_POST["set_albumName"], $_FILES["userfile"]["name"], $_POST["caption"]); break; case "new-album": // there is a title field as well, but since plogger doesn't use it, we drop it gr_add_album($_POST["set_albumName"], $_POST["newAlbumTitle"], $_POST["newAlbumDesc"]); break; default: $response->set_key("status", GR_STAT_UNKNOWN_CMD); $response->set_key("status_text", "Unknown command."); } $response->write();