:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/www/sukhadaworldapp/admin/**
:: Editing File: offer_update.php
<?php require_once 'db.php'; require_once 'session.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { // 1️⃣ Get Data $offer_id = (int)($_POST['offer_id'] ?? 0); $offer_heading = trim($_POST['offer_heading'] ?? ''); $button_text = trim($_POST['button_text'] ?? ''); $link = trim($_POST['link'] ?? ''); if ($offer_id <= 0) { $_SESSION['error'] = "Invalid Offer ID."; header("Location: offer.php"); exit; } if ($offer_heading == "" || $button_text == "" || $link == "") { $_SESSION['error'] = "All fields are required."; header("Location: offer_edit.php?id=$offer_id"); exit; } // 2️⃣ Update Query $sql = "UPDATE offers SET offer_heading = ?, button_text = ?, link = ?, updated_at = NOW() WHERE id = ?"; $stmt = mysqli_prepare($conn, $sql); if (!$stmt) { $_SESSION['error'] = "Database Error: " . mysqli_error($conn); header("Location: offer_edit.php?id=$offer_id"); exit; } mysqli_stmt_bind_param($stmt, "sssi", $offer_heading, $button_text, $link, $offer_id); if (mysqli_stmt_execute($stmt)) { $_SESSION['success'] = "Offer updated successfully!"; header("Location: offer.php"); exit; } else { $_SESSION['error'] = "Failed to update: " . mysqli_error($conn); header("Location: offer_edit.php?id=$offer_id"); exit; } } else { $_SESSION['error'] = "Invalid Request."; header("Location: offer.php"); exit; } ?>