:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/www/sukhadaworldapp/admin/**
:: Editing File: offer_save.php
<?php include_once("session.php"); include("db.php"); if ($_SERVER["REQUEST_METHOD"] == "POST") { // Get Form Data $offer_heading = trim($_POST['offer_heading'] ?? ''); $button_text = trim($_POST['button_text'] ?? ''); $link = trim($_POST['link'] ?? ''); $status = trim($_POST['status'] ?? 'Inactive'); // Validate Required Fields if ($offer_heading == "" || $button_text == "" || $link == "") { $_SESSION['error'] = "All fields are required!"; header("Location: offer_add.php"); exit; } // Insert Query $sql = "INSERT INTO offers (offer_heading, button_text, link, status, created_at, updated_at) VALUES (?, ?, ?, ?, NOW(), NOW())"; $stmt = mysqli_prepare($conn, $sql); if (!$stmt) { $_SESSION['error'] = "DB Error: " . mysqli_error($conn); header("Location: offer_add.php"); exit; } mysqli_stmt_bind_param($stmt, "ssss", $offer_heading, $button_text, $link, $status ); if (mysqli_stmt_execute($stmt)) { $_SESSION['success'] = "Offer added successfully!"; header("Location: offer.php"); exit; } else { $_SESSION['error'] = "Failed to save offer: " . mysqli_error($conn); header("Location: offer_add.php"); exit; } mysqli_stmt_close($stmt); mysqli_close($conn); } else { $_SESSION['error'] = "Invalid Request Method."; header("Location: offer_add.php"); exit; } ?>