Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
revealability
/
panel
/
admin
/
app
:
category_crud.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php session_start(); include '../../assets/constant/config.php'; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if (isset($_POST['submit'])) { $stmt = $conn->prepare("INSERT INTO `category`(`heading`) VALUES (?)"); $stmt->bindParam(1, $_POST['heading']); // $stmt->bindParam(2, $img); $stmt->execute(); $_SESSION['success'] = "Added blog"; ?> <script> // Redirect to ../about_seo.php window.location.href = "../manage_category.php"; </script> <?php } ////update Cateogory if (isset($_POST['update'])) { $stmt = $conn->prepare("UPDATE `category` SET `heading` = ? WHERE id= ? "); $stmt->bindParam(1, $_POST['heading']); // $stmt->bindParam(2, $img); $stmt->bindParam(2, $_POST['id']); $stmt->execute(); // exit; $_SESSION['success'] = "Category Updated"; ?> <script> // Redirect to ../about_seo.php window.location.href = "../manage_category.php"; </script> <?php } /////category delete if (isset($_POST['del_id'])) { $stmt = $conn->prepare("UPDATE `category` SET delete_status='1' where id=? "); $stmt->execute([htmlspecialchars($_POST['del_id'], ENT_QUOTES, 'UTF-8')]); $_SESSION['success'] = "Category Deleted"; ?> <script> // Redirect to ../about_seo.php window.location.href = "../manage_category.php"; </script> <?php } } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); } function compressImage($source, $destination, $quality) { $info = getimagesize($source); if ($info['mime'] == 'image/jpeg') { $image = imagecreatefromjpeg($source); imagejpeg($image, $destination, $quality); } elseif ($info['mime'] == 'image/png') { $image = imagecreatefrompng($source); imagepng($image, $destination, round(9 - ($quality / 10))); // PNG quality ranges from 0 to 9 } }