View file Remove image backgrounds/remove-bg/dark/admin-pannel/update_webpage.php

File size: 1.16Kb
<?php
   require_once('config/core.php');
   
   if ($_SERVER['REQUEST_METHOD'] === 'POST') {
       if (isset($_POST['id']) && isset($_POST['title']) && isset($_POST['meta_description']) && isset($_POST['meta_keyword'])) {
           $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
           
           // Escape user inputs for security
           $id = mysqli_real_escape_string($conn, $_POST['id']);
           $title = mysqli_real_escape_string($conn, $_POST['title']);
           $meta_description = mysqli_real_escape_string($conn, $_POST['meta_description']);
           $meta_keyword = mysqli_real_escape_string($conn, $_POST['meta_keyword']);
   
           // Update query
           $sql = "UPDATE webpages SET title='$title', meta_description='$meta_description', meta_keyword='$meta_keyword' WHERE id=$id";
   
           if (mysqli_query($conn, $sql)) {
               echo "Record updated successfully";
           } else {
               echo "Error updating record: " . mysqli_error($conn);
           }
   
           mysqli_close($conn);
       } else {
           echo "Invalid parameters";
       }
   } else {
       echo "Method not allowed";
   }
   ?>