Guest User

Untitled

a guest
Nov 17th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.55 KB | None | 0 0
  1. <?php
  2.    session_start();
  3. ?>
  4.  
  5. <!DOCTYPE HTML>
  6. <HTML>
  7.  
  8.  
  9. <body>
  10.     <!-- Bootstrap core CSS -->
  11.     <link href="../home/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  12.  
  13.     <!-- Custom fonts for this template -->
  14.     <link href="../home/vendor/fontawesome-free/css/all.min.css" rel="stylesheet">
  15.     <link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet">
  16.     <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
  17.     <!-- Custom styles for this template -->
  18.     <link href="../home/css/grayscale.min1.css" rel="stylesheet">
  19. <?php
  20.  
  21. //------------------------------------------comme celle de spoon.php------------------------------------------------
  22. foreach ($_SESSION['arrstockIdFromBD'] as $i){ //--------------------> nbr de resultats affichees
  23.     if (isset($_POST['del'.$i])){  //--------------------> test sur tous les boutons ex : del609823
  24.         include_once 'db.inc.php' ; //--------------------> ou on a la db pour utiliser $conn
  25.         //--------------------------------- delete from db ------------------------------------------
  26.         $usr = $_SESSION['idOfUser'] ;
  27.         $sql = "delete from recipes WHERE user_id = ".$usr." and recipe_id = ? "; //--------------------> query
  28.         $stmt = mysqli_stmt_init($conn) ;
  29.         if(!mysqli_stmt_prepare($stmt, $sql)) {
  30.             echo "operation failed " ;
  31.         }else {
  32.             //-------------------->$_SESSION['idOfUser'] le id de notre user ;
  33.             mysqli_stmt_bind_param($stmt,"s",$i); //$_SESSION['idOfUser'],$d,$_SESSION['idOfUser'],
  34.             mysqli_stmt_execute($stmt) ;
  35.             echo '<section id="about" class="about-section text-center">
  36.             <div class="container">
  37.                 <div class="row">
  38.                     <div class="col-lg-8 mx-auto">
  39.                 <h2 class="text-info mb-4">Deleting from your favories list ...</h2>
  40.                     </div>
  41.                 </div>
  42.             </div>
  43.             </section>
  44.             <br><br><br>
  45.             <div class="text-center">
  46.             <div class="spinner-border text-success" width = "30rem" height = "30rem" role="status">
  47.             <span class="sr-only" >Loading...</span>
  48.             </div>'
  49.             ;
  50.             //-------------- back 2 pages from history ------------------------------------
  51.             echo "<script language='javascript'>
  52.                 window.history.go(-1) ;
  53.                 </script>
  54.                 ";
  55.         }
  56.     }
  57. }
  58. ?>
Add Comment
Please, Sign In to add comment