Advertisement
Guest User

Untitled

a guest
May 19th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.22 KB | None | 0 0
  1. <html>
  2. <head>
  3.     <meta charset="UTF-8">
  4.     <title>LISTA</title> 
  5.     <link type="text/css" rel="stylesheet" href="stilepopup.css"> <!-- link al foglio di stile -->
  6. </head>
  7. <body>
  8. <?php
  9.     $host = "localhost";
  10.     $user = "quintaainfo1516";
  11.     $password = "diploma2016";
  12.     $conn = mysql_connect($host, $user, $password);
  13.     if(!$conn){
  14.           die("errore in connessione - " . mysql_error());    
  15.     }
  16.     mysql_select_db("merende",$conn) or die("Accesso al database non riuscito - " . mysql_error());
  17.     session_start();
  18.     $id = $_SESSION["id"];
  19.     $pwd = $_SESSION["pwd"];
  20.     $querym = "select distinct(Nome), Sezione FROM g3utenti, g3ordini WHERE g3utenti.ID_U=g3ordini.ID_U AND g3utenti.Nome = 3 OR g3utenti.Nome = 4 OR g3utenti.Nome = 5";
  21.     $queryr = "select distinct(Nome), Sezione FROM g3utenti, g3ordini WHERE g3utenti.ID_U=g3ordini.ID_U AND g3utenti.Nome = 1 OR g3utenti.Nome = 2";
  22.     if(($id=="Massi") && ($pwd=="cottoemaio")){
  23.       //codice massi
  24.         $ris_query =  mysql_query($querym,$conn);
  25.         print "<div>";
  26.             while($riga=mysql_fetch_array($ris_query)){
  27.                 $nome=$riga['Nome'];
  28.                 $sez=$riga['Sezione'];
  29.                 print " <a id='myBtn' href='area_massi.php?v1=$nome&v2=$sez'>".$nome.$sez."</a>";
  30.             }
  31.     }
  32.     if((isset($_GET["v1"]))&&(isset($_GET["v2"]))){
  33.    
  34.     $nome2=$_GET['v1'];
  35.     $sez2=$_GET['v2'];
  36.     $tot=0;
  37.     $queryo = "SELECT g3prodotti.descrizione, g3ordini.Quantita, g3ordini.Note, g3prodotti.prezzo*g3ordini.Quantita AS PrezzoTot
  38.                FROM g3prodotti, g3ordini, g3utenti
  39.                WHERE g3ordini.ID_P=g3prodotti.ID_P
  40.                AND g3ordini.ID_U=g3utenti.ID_U
  41.                AND g3utenti.Nome= '$nome2'
  42.                AND g3utenti.Sezione = '$sez2'
  43.                GROUP BY g3prodotti.descrizione";
  44.                 $ris_query2 =  mysql_query($queryo,$conn);//oggetto che salva il risultato della query
  45.     print "<div id='myModal' class='modal'>";
  46.         print "<div class='modal-content'>";
  47.             print "<div class='modal-header'>";
  48.                 print "<span class='close'>×</span>";
  49.                 print "<h2>".$nome2." ".$sez2."</h2>";
  50.             print "</div>";
  51.             print "<div class='modal-body'>";
  52.                 print "<table>";
  53.                     while($riga2=mysql_fetch_array($ris_query2)){
  54.                         $s="<tr>";
  55.                         $s.="<td>".$riga2['descrizione']."</td>";
  56.                         $s.="<td>".$riga2['Quantita']."</td>";
  57.                         $s.="<td>".$riga2['Note']."</td>";
  58.                         $s.="<td>".$riga2['PrezzoTot']."</td>";
  59.                         $s.="</tr>";
  60.                         $tot = $tot + $riga2['PrezzoTot'];
  61.                         print $s;
  62.                     }
  63.                 print "</table>";
  64.                 echo "prezzo totale: €".$tot;
  65.             print "</div>";            
  66.         print "</div>";            
  67.     print "</div>";
  68. }
  69.    
  70.  
  71.  
  72.     //if(($id=="Rossella") && ($pwd=="rossaetonda")){
  73.       //codice rossella
  74.       //  $ris_query =  mysql_query($queryr,$conn);
  75.        // while($riga=mysql_fetch_array($ris_query)){
  76.          //   $html=$riga['Nome'].$riga['Sezione'];          
  77.            // $button="<p><button id='1' onclick='myFunction()' style='visibility:visible'>".$html."</button></p>";
  78.             //echo $button;  
  79.         //}
  80.     //}
  81.  
  82.  
  83.  
  84.    
  85. ?>
  86.  
  87. <script language="JavaScript" type="text/javascript">
  88.  
  89. // Get the modal
  90. var modal = document.getElementById('myModal');
  91.  
  92. // Get the button that opens the modal
  93. var btn = document.getElementById("myBtn");
  94.  
  95. // Get the <span> element that closes the modal
  96. var span = document.getElementsByClassName("close")[0];
  97.  
  98. // When the user clicks on the button, open the modal
  99. btn.onclick = function() {
  100.     modal.style.display = "block";
  101. }
  102.  
  103. // When the user clicks on <span> (x), close the modal
  104. span.onclick = function() {
  105.     modal.style.display = "none";
  106. }
  107.  
  108. // When the user clicks anywhere outside of the modal, close it
  109. window.onclick = function(event) {
  110.     if (event.target == modal) {
  111.         modal.style.display = "none";
  112.     }
  113. }
  114.  
  115. </script>
  116.  
  117.  
  118. <a href="logfuori.php"> logout </a>
  119. </body>
  120. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement