find($id); if (!$row) { echo '

找不到這筆資料。

'; return; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $row['title'] = trim($_POST['title'] ?? $row['title']); $row['type'] = $_POST['type'] ?? $row['type']; $row['platform'] = $_POST['platform'] ?? $row['platform']; if (!empty($_FILES['poster']['name']) && $_FILES['poster']['error'] === UPLOAD_ERR_OK) { $ext = strtolower(pathinfo($_FILES['poster']['name'], PATHINFO_EXTENSION)); $row['poster'] = uniqid('poster_') . '.' . $ext; move_uploaded_file($_FILES['poster']['tmp_name'], __DIR__ . '/../uploads/' . $row['poster']); } $row['watch_url'] = trim($_POST['watch_url'] ?? ''); $row['current_season'] = max(1, (int)($_POST['current_season'] ?? 1)); $row['current_episode'] = max(0, (int)($_POST['current_episode'] ?? 0)); $row['current_position'] = trim($_POST['current_position'] ?? ''); $row['progress_note'] = trim($_POST['progress_note'] ?? ''); $row['status'] = $_POST['status'] ?? $row['status']; $row['rating'] = ($_POST['rating'] !== '') ? $_POST['rating'] : ''; $row['intro'] = trim($_POST['intro'] ?? ''); $row['note'] = trim($_POST['note'] ?? ''); $Drama->save($row); to("?do=drama"); exit; } ?>

編輯作品

取消