Server IP : 2a02:4780:3:1378:0:3736:a38e:10 / Your IP : 3.21.106.4 Web Server : LiteSpeed System : Linux sg-nme-web1278.main-hosting.eu 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : u926327694 ( 926327694) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u926327694/domains/stjpuvjp.com/../smsoft.in/../stjpuvjp.com/public_html/gallery/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php session_start(); ?> <?php error_reporting(E_ALL ^ E_WARNING); // First we execute our common code to connection to the database and start the session // At the top of the page we check to see whether the user is logged in or not if(empty($_SESSION['userlogin'])) { // If they are not, we redirect them to the login page. header("Location: index.php"); // Remember that this die statement is absolutely critical. Without it, // people can view your members-only content without logging in. die("Redirecting to index.php"); } // Everything below this point in the file is secured by the login system // We can display the user's username to them by reading it from the session array. Remember that because // a username is user submitted content we must use htmlentities on it before displaying it to the user. ?> <?php include 'functions.php'; $pdo = pdo_connect_mysql(); $msg = ''; // Check that the poll ID exists if (isset($_GET['id'])) { // Select the record that is going to be deleted $stmt = $pdo->prepare('SELECT * FROM images_sta WHERE id = ?'); $stmt->execute([$_GET['id']]); $image = $stmt->fetch(PDO::FETCH_ASSOC); if (!$image) { die ('Image doesn\'t exist with that ID!'); } // Make sure the user confirms beore deletion if (isset($_GET['confirm'])) { if ($_GET['confirm'] == 'yes') { // User clicked the "Yes" button, delete file & delete record unlink($image['path']); $stmt = $pdo->prepare('DELETE FROM images_sta WHERE id = ?'); $stmt->execute([$_GET['id']]); // Output msg $msg = 'You have deleted the image!'; } else { // User clicked the "No" button, redirect them back to the home/index page header('Location: index.php'); exit; } } } else { die ('No ID specified!'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>K.H.Patil College of Commerce</title> <link href="style1.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"> <link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon"> <style> </style> </head> <body> <nav class="navtop"> <div> <h1>Image Delete</h1> <a href="gallery.php"><i class="fas fa-image"></i>Gallery</a> </div> </nav> <div class="content delete"> <h2>Delete Image #<?=$image['id']?></h2> <?php if ($msg): ?> <p><?=$msg?></p> <?php else: ?> <p>Are you sure you want to delete <?=$image['title']?>?</p> <div class="yesno"> <a href="delete.php?id=<?=$image['id']?>&confirm=yes">Yes</a> <a href="delete.php?id=<?=$image['id']?>&confirm=no">No</a> </div> <?php endif; ?> </div> </body> </html>