prepare("INSERT INTO apps (name, description, age_rating, age_rating_description, platforms) VALUES (?, ?, ?, ?, ?)"); if (!$stmt) { $error = "Database error: " . $conn->error; } if ($stmt) { $stmt->bind_param("sssss", $name, $description, $ageRating, $_POST['age_rating_description'], $platforms); if ($stmt->execute() === TRUE) { $appId = $stmt->insert_id; // 保存标签关联 if (!empty($_POST['tags'])) { $stmt = $conn->prepare("INSERT INTO app_tags (app_id, tag_id) VALUES (?, ?)"); foreach ($_POST['tags'] as $tagId) { $stmt->bind_param("ii", $appId, $tagId); $stmt->execute(); } $stmt->close(); } // 处理上传的预览图片 if (!empty($_FILES['images']['name'][0])) { $uploadDir = '../images/'; foreach ($_FILES['images']['tmp_name'] as $key => $tmpName) { $fileName = basename($_FILES['images']['name'][$key]); $targetPath = $uploadDir . $fileName; if (move_uploaded_file($tmpName, $targetPath)) { $insertImageSql = "INSERT INTO app_images (app_id, image_path) VALUES (?, ?)"; $imgStmt = $conn->prepare($insertImageSql); $imgStmt->bind_param("is", $appId, $targetPath); $imgStmt->execute(); } } } // 处理上传的App文件 if (!empty($_FILES['app_file']['name'])) { $uploadDir = '../files/'; $fileName = basename($_FILES['app_file']['name']); $targetPath = $uploadDir . $fileName; if (move_uploaded_file($_FILES['app_file']['tmp_name'], $targetPath)) { $version = $_POST['version']; $changelog = $_POST['changelog']; $insertVersionSql = "INSERT INTO app_versions (app_id, version, changelog, file_path) VALUES (?, ?, ?, ?)"; $verStmt = $conn->prepare($insertVersionSql); $verStmt->bind_param("isss", $appId, $version, $changelog, $targetPath); $verStmt->execute(); } } echo ''; exit; } else { echo ''; } } } ?> 添加App - <?php echo APP_STORE_NAME; ?>

应用管理系统

欢迎, 登出
\n\n\n \n \n 添加App - <?php echo APP_STORE_NAME; ?>\n \n \n \n \n \n \n \n

添加App

取消