Advertisement
barbos01

delete.php

May 24th, 2022
1,136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.02 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. include("auth.php"); //include auth.php file on all secure pages ?>
  5. <!DOCTYPE html>
  6. <html>
  7.  
  8. <head>
  9.     <meta charset="utf-8" />
  10.     <meta http-equiv="x-ua-compatible" content="ie=edge" />
  11.     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  12.     <title>Foundation for Sites</title>
  13.     <link rel="stylesheet" href="css/foundation.css" />
  14.     <link rel="stylesheet" href="css/app.css" />
  15.     <link rel="stylesheet" href="css/app.css" />
  16.     <link rel="stylesheet" href="css/styleAuth.css" />
  17.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  18.     <script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
  19.     <style>
  20.       body {
  21.           background-color: rgb(255, 255, 255);
  22.         }
  23.         img {
  24.           border-radius: 8px;
  25.           display: block;
  26.           margin-left: auto;
  27.           margin-right: auto;
  28.           width: 60%
  29.         }
  30.        
  31.         .card {
  32.           background-color: rgb(255, 255, 255);
  33.           padding-top: 5%;
  34.           border: 0px;
  35.           width: auto;
  36.           height: 650px;
  37.         }
  38.         .top-bar, .top-bar ul {
  39.           background-color: #ff0000;
  40.          color: white;
  41.       }
  42.       a {
  43.         color: white;
  44.       }
  45.       a:hover {
  46.         color: black;
  47.       }
  48.       .links-button {
  49.             display: inline-block;
  50.             vertical-align: middle;
  51.             margin: 0 0 1rem 0;
  52.             font-family: inherit;
  53.             padding: 0.85em 1em;
  54.             -webkit-appearance: none;
  55.             border: 1px solid rgb(0, 0, 0);
  56.             border-radius: 0;
  57.             transition: background-color 0.25s ease-out, color 0.25s ease-out;
  58.             font-size: 0.8rem;
  59.             line-height: 1;
  60.             text-align: center;
  61.             cursor: pointer;
  62.             background-color: #060a085b;
  63.            color: #fefefe;
  64.        }
  65.  
  66.         #customers {
  67.            font-family: Arial, Helvetica, sans-serif;
  68.             border-collapse: collapse;
  69.             width: 100%;
  70.         }
  71.  
  72.         #customers td,
  73.        #customers th {
  74.            border: 1px solid #ddd;
  75.            padding: 8px;
  76.         }
  77.  
  78.         #customers tr {
  79.            background-color: white;
  80.         }
  81.  
  82.         #customers tr:hover {
  83.            background-color: wheat;
  84.         }
  85.  
  86.         #customers th {
  87.            padding-top: 12px;
  88.             padding-bottom: 12px;
  89.             text-align: left;
  90.             background-color: #a64200;
  91.            color: white;
  92.         }
  93.  
  94.         div .container {
  95.             margin: 0px 0px;
  96.             padding: 0px 0px;
  97.            
  98.         }
  99.        
  100.         ul.pagination a{
  101.             display: inline-block;
  102.             vertical-align: middle;
  103.             margin: 0 0 1rem 0;
  104.             font-family: inherit;
  105.             padding: 0.85em 1em;
  106.             -webkit-appearance: none;
  107.             border: 1px solid rgb(0, 0, 0);
  108.             border-radius: 0;
  109.             transition: background-color 0.25s ease-out, color 0.25s ease-out;
  110.             font-size: 0.8rem;
  111.             line-height: 1;
  112.             text-align: center;
  113.             cursor: pointer;
  114.             background-color: #9d0011;
  115.            color: #fefefe;
  116.        }
  117.         ul.pagination a:visited {
  118.             background-color: #9d0011;
  119.            color: black;
  120.         }
  121.         td>h3>a {
  122.           color: black;
  123.           font-size: 1.1rem;
  124.         }
  125.         #customers a {
  126.            color: black;
  127.         }
  128.         #customers a:hover {
  129.            color: #9d0011;
  130.        }
  131.         .adb {
  132.             padding-top: 150px;
  133.         }
  134.         .align-rbtn {
  135.             display: line;  
  136.         }
  137.     </style>
  138.     <script>
  139.             // Using ES6 feature.
  140.             let redirect_Page = (ele) => {
  141.                
  142.                 ele.value = 'Inapoi la adminPanel in 5 secunde ...';
  143.                 ele.disabled = true;
  144.                 alert("Felicitari");
  145.                
  146.                 let tID = setTimeout(function () {
  147.  
  148.                     // redirect page.
  149.                     window.location.href = 'adminPanel.php';
  150.                    
  151.                     window.clearTimeout(tID);       // clear time out.
  152.                    
  153.                 }, 5000);   // call function after 5000 milliseconds or 5 seconds
  154.             }
  155.             let redirect_Page1 = (ele) => {
  156.                
  157.                 ele.value = 'Inapoi la adminPanel in 5 secunde ...';
  158.                 ele.disabled = true;
  159.                 alert("Topicul a fost sters cu succes!");
  160.                
  161.                 let tID = setTimeout(function () {
  162.  
  163.                     // redirect page.
  164.                     window.location.href = 'adminPanel.php';
  165.                    
  166.                     window.clearTimeout(tID);       // clear time out.
  167.                    
  168.                 }, 5000);   // call function after 5000 milliseconds or 5 seconds
  169.             }
  170.  
  171. </script>
  172. </head>
  173. <body>
  174.     <?php
  175.       include("verificare.php");
  176.       if($_SESSION["type"] == 0) {
  177.         echo "<script>window.location.href='index.php';</script>";  
  178.       }
  179.       else {
  180.         include("header-admin.php");
  181.       }
  182.        
  183.     ?>
  184.     <?php
  185.         if($_GET['table'] == 'judet') {
  186.     ?>
  187.  
  188.                 <div class = "adb">
  189.                     <form id="topicForm" action="" method="POST">
  190.                         <label for="fname">Esti sigur ca vrei sa stergi? </label>
  191.                         <input type="text" id="fname" name="numJUD" value="">
  192.                         <input type="submit" name="submit" value="DA!" />
  193.                     </form>
  194.                 </div>
  195.  
  196.     <?php
  197.         }
  198.         else if($_GET['table'] == 'topic') {
  199.             ?>
  200.        
  201.                     <div class = "adb">
  202.                         <form id="topicForm" action="" method="POST">
  203.                         <label for="fname">Doriti sa stergeti topicul: <b><?php echo $_GET['top'] ?></b>, din categoria <b><?php echo $_GET['jud'] ?></b>?</label>
  204.                         <div class = "align-rbtn">
  205.                             <input type="submit" name="submit" value="DA!"/>
  206.                             <input type="submit" name="submitno" value="NU!" id='bt' onclick='redirect_Page(this)' />
  207.                         </div>
  208.                         </form>
  209.                     </div>
  210.        
  211.             <?php
  212.                 }
  213.     ?>
  214.  
  215.     <?php include('footer.php') ?>
  216. </body>
  217.  
  218. </html>
  219.  
  220. <?php
  221.  
  222.     if((isset($_POST['submit']) || isset($_POST['submitno']))and $_GET['table'] == 'topic'){
  223.         if(isset($_POST['submit'])) {
  224.         $id_top = $_GET['id_top'];
  225.         $sql = "DELETE FROM topic WHERE id='$id_top'";
  226.         $result = mysqli_query($con,$sql);
  227.         echo '<script>alert("Topicul a fost sters cu succes!");</script>';
  228.         echo "<script>window.location.href='adminPanel.php';</script>";
  229.         }
  230.         else {
  231.             //echo "<script>window.location.href='adminPanel.php';</script>";
  232.         }
  233.     }
  234.  
  235. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement