Advertisement
Guest User

pizzav4

a guest
Mar 17th, 2011
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.95 KB | None | 0 0
  1. <?php
  2. error_reporting(-1); // -1 = alle Bits gesetzt, alle Fehler anzeigen
  3. session_start();
  4. ?>
  5. <!DOCTYPE HTML>
  6. <html>
  7. <head>
  8.  <title>Pizza da Mamma</title>
  9.  <meta http-equiv="Content-typee" content="text/html; charset=iso-8859-1" />
  10.  <link rel="stylesheet" typee="text/css" href="../css/style.css" />
  11. </head>
  12. <body>
  13.  <div id="header">
  14.   <img src="../images/logo/171x37.png" alt="" width="171" height="37" />
  15.   <div class="small">
  16.    <a href="../index.html"><img src="../images/small1.gif" alt="" width="13" height="13" /></a>
  17.    <a href="../html/überuns.html"><img src="../images/small2.gif" alt="" width="16" height="13" /></a>
  18.    <a href="mailto:alex.waelchli@bluewin.ch"><img src="../images/small3.gif" alt="" width="16" height="13" /></a>
  19.   </div>
  20.  </div>
  21.  <div class="menu">
  22.   <img src="../images/lefttop.png" alt="" width="37" height="56" />
  23.   <ul>
  24.    <li><a href="../index.html" ><img src="../images/but1.gif.png" alt="" onmouseover="this.src='../images/but1_hover.gif.png';" onmouseout="this.src='../images/but1.gif.png'" width="109" height="30" /></a></li>
  25.    <li><a href="../html/überuns.html"><img src="../images/but2.gif.png" alt="" onmouseover="this.src='../images/but2_hover.gif.png';" onmouseout="this.src='../images/but2.gif.png'" width="109" height="30" /></a></li>
  26.    <li><a href="../html/sortiment.html"><img src="../images/but3.gif.png" alt="" onmouseover="this.src='../images/but3_hover.gif.png';" onmouseout="this.src='../images/but3.gif.png'" width="109" height="30" /></a></li>
  27.    <li><a href="bestellung.php"><img src="../images/but5_active.png" alt="" onmouseover="this.src='../images/but5_hover.png';" onmouseout="this.src='../images/but5_active.png'" width="109" height="30" /></a></li>
  28.    <li><a href="../html/standort.html"><img src="../images/but4.gif.png" alt="" onmouseover="this.src='../images/but4_hover.gif.png';" onmouseout="this.src='../images/but4.gif.png'" width="108" height="30" /></a></li>
  29.   </ul>
  30.  </div>
  31.     <div id="phpcontent"><br><br>
  32.        <div id="bestellungmenu">
  33.         <?php
  34.         $pizzaa="";
  35.         $pastaa="";
  36.         $spezialitätena="";
  37.         $getränkea="";
  38.         $insalatea="";
  39.         $desserta="";
  40.         if(isset($_GET['anzeige'])){
  41.                  if($_GET['anzeige'] =="pizza"){$pizzaa="_active";}
  42.                  if($_GET['anzeige'] =="pasta"){$pastaa="_active";}
  43.                  if($_GET['anzeige'] =="spezialitäten"){$spezialitätena="_active";}
  44.                  if($_GET['anzeige'] =="getränke"){$getränkea="_active";}
  45.                  if($_GET['anzeige'] =="insalate"){$insalatea="_active";}
  46.                  if($_GET['anzeige'] =="dessert"){$desserta="_active";}
  47.         }else{
  48.         $pizzaa="_active";
  49.         }
  50.         ?>
  51.          <ul>
  52.         <li><a href="?anzeige=pizza" ><img src="../images/butpizza<?php echo $pizzaa;?>.png" alt="" onmouseover="this.src='../images/butpizza_hover.png';" onmouseout="this.src='../images/butpizza<?php echo $pizzaa;?>.png'" width="109" height="30" /></a></li>
  53.       </ul>
  54.          <ul>
  55.         <li><a href="?anzeige=pasta" ><img src="../images/butpasta<?php echo $pastaa;?>.png" alt="" onmouseover="this.src='../images/butpasta_hover.png';" onmouseout="this.src='../images/butpasta<?php echo $pastaa;?>.png'" width="109" height="30" /></a></li>
  56.       </ul>
  57.          <ul>
  58.         <li><a href="?anzeige=spezialitäten" ><img src="../images/butspezialitäten<?php echo $spezialitätena;?>.png" alt="" onmouseover="this.src='../images/butspezialitäten_hover.png';" onmouseout="this.src='../images/butspezialitäten<?php echo $spezialitätena;?>.png'" width="109" height="30" /></a></li>
  59.       </ul>
  60.          <ul>
  61.         <li><a href="?anzeige=getränke" ><img src="../images/butgetränke<?php echo $getränkea;?>.png" alt="" onmouseover="this.src='../images/butgetränke_hover.png';" onmouseout="this.src='../images/butgetränke<?php echo $getränkea;?>.png'" width="109" height="30" /></a></li>
  62.       </ul>
  63.          <ul>
  64.         <li><a href="?anzeige=insalate" ><img src="../images/butinsalate<?php echo $insalatea;?>.png" alt="" onmouseover="this.src='../images/butinsalate_hover.png';" onmouseout="this.src='../images/butinsalate<?php echo $insalatea;?>.png'" width="109" height="30" /></a></li>
  65.       </ul>
  66.          <ul>
  67.         <li><a href="?anzeige=dessert" ><img src="../images/butdessert<?php echo $desserta;?>.png" alt="" onmouseover="this.src='../images/butdessert_hover.png';" onmouseout="this.src='../images/butdessert<?php echo $desserta;?>.png'" width="109" height="30" /></a></li>
  68.       </ul>
  69.        </div>
  70.         <div id="notizen">
  71.             <?
  72.             /*
  73.             karte.txt
  74.                       1;Pizza Margherita;pizza;13.00,25.00;(normal),(gross)
  75.                       2;Pizza Marinara;pizza;16.00,27.00;(normal),(gross)
  76.                       3;Pizza Funghi;pizza;16.00,27.00;(normal),(gross)
  77.                       4;Pizza Prosciutto;pizza;18.00,29.00;(normal),(gross)
  78.                       5;Pizza Prosciutto e funghi;pizza;19.00,30.00;(normal),(gross)
  79.                       6;Pizza Quattro stagioni;pizza;19.00,30.00;(normal),(gross)
  80.                       7;Pizza Tonno;pizza;19.00,30.00;(normal),(gross)
  81.                       8;Pizza Diavola;pizza;19.00,30.00;(normal),(gross)
  82.                       9;Pizza Capricciosa;pizza;19.00,30.00;(normal),(gross)
  83.                       10;Pizza Exotica;pizza;19.00,30.00;(normal),(gross)
  84.                       11;Pizza Carbonara;pizza;19.00,30.00;(normal),(gross)
  85.                       12;Pizza Sfiziosa;pizza;19.00,30.00;(normal),(gross)
  86.                       13;Pizza Parmigiana;pizza;19.00,30.00;(normal),(gross)
  87.                       14;Pizza Quattro formaggi;pizza;19.00,30.00;(normal),(gross)
  88.                       15;Pizza Contandina;pizza;20.00,32.00;(normal),(gross)
  89.                       16;Pizza Deliziosa;pizza;20.00,32.00;(normal),(gross)
  90.                       17;Pizza Europizza;pizza;20.00,32.00;(normal),(gross)
  91.                       18;Pizza Delfino;pizza;21.00,36.00;(normal),(gross)
  92.                       19;Pizza Mare e Monti;pizza;21.00,35.00;(normal),(gross)
  93.                       20;Pizza Carettiera;pizza;21.00,35.00;(normal),(gross)
  94.                       21;Pizza Dinamite;pizza;21.00,35.00;(normal),(gross)
  95.                       22;Pizza Profumo di Bosco;pizza;22.00,35.00;(normal),(gross)
  96.                       23;Pizza Calzone;pizza;19.00;(normal)
  97.                       24;Pizza Calzone farcito;pizza;22.00;(normal)
  98.                       25;Pizza Bella Capri speziale;pizza;35.00;(normal)
  99.                       26;Scaloppine al limone;spezialitäten;30.00;(gross)
  100.                       27;Frittura mista di pesce;spezialitäten;30.00;(gross)
  101.                       28;Verde;insalate;7.00;(normal)
  102.                       29;Mista;insalate;8.00;(normal)
  103.                       30;Songino;insalate;10.00;(normal)
  104.                       31;Rucola;insalate;13.00;(normal)
  105.                       32;Caprese;insalate;11.00;(normal)
  106.                       33;Griechischer Salat (min 300gr);insalate;14.00;(normal)
  107.                       34;Spaghetti alla Mafiosa;pasta;17.00;(normal)
  108.                       35;Spaghetti Carbonara;pasta;18.00;(normal)
  109.                       36;Penne all'arrabiata;pasta;17.00;(normal)
  110.                       37;Penne Wodka;pasta;18.00;(normal)
  111.                       38;Penne Marc e Campagna;pasta;21.00;(normal)
  112.                       39;Canneloni;pasta;18.00;(normal)
  113.                       40;Lasagne;pasta;18.00;(normal)
  114.                       41;Tirami'su;dessert;8.00;(normal)
  115.                       42;Mousse au chocolat;dessert;7.00;(normal)
  116.                       43;Tagesdessert (auf Anfrage);dessert;15.00;(normal)
  117.                       44;Glace-Kugel;dessert;3.00;(normal)
  118.                       45;Schlagrahm;dessert;1.00;(normal)
  119.                       46;Nature;getränke;4.00;(50cl)
  120.                       47;Tafelgetränke;getränke;4.00;(50cl)
  121.                       48;Eistee;getränke;4.00;(50cl)
  122.                       49;Hürlimann Bier;getränke;3.50;(33cl)
  123.                       50;Tuborg Bier;getränke;4.00;(33cl)
  124.                       51;Carlsberg Bier;getränke;4.00;(33cl)
  125.                       52;Clausthaler Bier;getränke;3.50;(33cl)
  126.                       53;Weisswein;getränke;13.00;(50cl)
  127.                       54;Rosewein;getränke;13.00;(50cl)
  128.                       55;Rotwein;getränke;13.00;(50cl)
  129.             etc. */
  130.                  $ii="";
  131.             $karte_array = array();
  132.             $zeilen = file ("karte.txt");
  133.             foreach ($zeilen as $zeile) {
  134.             list($id,$name,$gruppe,$preis,$einheit) = explode(";", $zeile);
  135.             $preis_array=explode(",", $preis);
  136.             $preisanzahl=count($preis_array);
  137.             $einheit_array=explode(",", $einheit);
  138.             $karte_array[$id]=$name;
  139.                  if((isset($_GET['anzeige']) && $gruppe == $_GET['anzeige']) || (!isset($_GET['anzeige']) && $gruppe == "pizza")){ #if($gruppe==$gruppe){ wenn alle gruppen angezeigt werden sollen
  140.                   # in SESSION speichern nach Senden
  141.                   if(isset($_POST[$id."_notizen"]) && $_POST[$id."_notizen"]!=""){
  142.                            $_SESSION["KORB"][$id."_".time()] = $_POST[$id."_notizen"];
  143.                            $_SESSION["KORB_preis"][$id."_".time()] = $_POST[$id."_preis"];
  144.                   }
  145.                   $outputradio="";
  146.                   if($preisanzahl == "1"){
  147.                           $outputradio="<input type='radio' name='".$id."_preis' value='".$preis."|".$einheit."'>".$preis." ".$einheit."<br>";
  148.                   }else{
  149.                           for($i=0; $i < count($preis_array);$i++){
  150.                           $outputradio.="<input type='radio' name='".$id."_preis' value='".$preis_array[$i]."|".$einheit_array[$i]."'>".$preis_array[$i]." ".$einheit_array[$i]."<br>";
  151.                           }
  152.                   }
  153.                  $ii++;
  154.                  $bgcolor= ($ii % 2 === 0) ? '#ccc':'#ddd';
  155.                   echo '<form style="background-color:'.$bgcolor.'" action="#" method="post" name="form">';
  156.                   echo "".$id.". ".$name." <br>";
  157.                   echo '<input type="text" style="border:1px solid black; width:20px" maxlength="2" name="'.$id.'_notizen" value=""><br>';
  158.                   echo $outputradio;
  159.                   echo '&nbsp; <input type="submit" class="formbutton" style="width:180px" value="Anzahl speichern"></form>';
  160.                  }
  161.             }
  162.             ?>
  163.         </div>
  164.         <div id="notizen_anzeigen">
  165.                <center><b>DEIN WARENKORB</b><br /></center><br>
  166.                <?php
  167.                 # unset($_SESSION["KORB"]); unset($_SESSION["KORB_preis"]);
  168.             $_SESSION["BESTELLUNG"]="";
  169.     if(isset($_SESSION["KORB"])){
  170.                   #############################
  171.                   # Warenkorb +/-/x verarbeitung
  172.                  if(isset($_GET["key"]) && isset($_GET["plus"])){
  173.                   $_SESSION["KORB"][$_GET["key"]]=($_SESSION["KORB"][$_GET["key"]]+1);
  174.                  }elseif(isset($_GET["key"]) && isset($_GET["minus"])){
  175.                     $_SESSION["KORB"][$_GET["key"]]=((float)$_SESSION["KORB"][$_GET["key"]]-1);
  176.                     if($_SESSION["KORB"][$_GET["key"]]<"1"){
  177.                      unset($_SESSION["KORB"][$_GET["key"]]);
  178.                     }
  179.                  }elseif(isset($_GET["key"]) && isset($_GET["raus"])){
  180.                     unset($_SESSION["KORB"][$_GET["key"]]);
  181.                  }
  182.                   # Warenkorb +/-/x verarbeitung
  183.                   #############################
  184.                 echo "<small>";
  185.                 # alle Daten aus SESSION Anzeigen
  186.                 ksort ($_SESSION["KORB"]);
  187.                 ksort ($_SESSION["KORB_preis"]);
  188.                 $preisges="";
  189.                 foreach($_SESSION["KORB"] as $key => $value){
  190.                 list($PREIS,$EINHEIT) = explode("|", $_SESSION['KORB_preis'][$key]);
  191.                  $preis =($value*$PREIS);
  192.                 echo $karte_array[trim(preg_replace('/_[\d]*$/', ' ', $key))]." ".$EINHEIT.": ".$value." x ".$PREIS." = ".number_format($preis, 2, '.', '');
  193.                                  $_SESSION["BESTELLUNG"] .= $karte_array[trim(preg_replace('/_[\d]*$/', ' ', $key))]." ".$EINHEIT.": ".$value." x ".$PREIS." = ".number_format($preis, 2, '.', '')."<br>";
  194.                                  echo "
  195.                  <a style='text-decoration:none' href='?key=".$key."&amp;minus'>[-]</a>
  196.                  <a style='text-decoration:none' href='?key=".$key."&amp;plus'>[+]</a>
  197.                  <a style='text-decoration:none' href='?key=".$key."&amp;raus'>[x]</a>
  198.                  <br>";
  199.                 $preisges+=$preis;
  200.                 }
  201.                 echo "<br>";
  202.                 echo "<hr />";
  203.                 echo "Total: ".number_format($preisges, 2, '.', '')." CHF</small>";
  204.                                  $_SESSION["BESTELLUNG"] .= "Total: ".number_format($preisges, 2, '.', '')." CHF</small>";
  205.                 ####################################################################
  206.         if(isset($_POST['bestellungsenden'])){
  207.  
  208.                  $Name = $_POST['Name'];
  209.                  $Vorname = $_POST['Vorname'];
  210.                  $Strasse = $_POST['Strasse'];
  211.                  $PLZ = $_POST['PLZ'];
  212.                  $Ort = $_POST['Ort'];
  213.                  $emailkunde=$_POST['emailkunde'];
  214.                  $Mail_To = "pizzadamamma.kontakt@bluewin.ch, $emailkunde";
  215.                                   $Mail_To = "andreazza@gmx.de";
  216.                  $Mail_From="From: \"PIZZA LADEN\"<pizzadamamma.kontakt@bluewin.ch>\n";
  217.                  $message = "
  218.                           <font color='#333333' face='Verdana, Bookman Old Style' size='2'>
  219.                           <br><br>Lieber Kunde, die folgende Bestellung haben sie so eben getätigt:<br>
  220.                                                   <br>
  221.                           $_SESSION[BESTELLUNG]
  222.                           <br><br>
  223.                           Kundendaten:<br>
  224.                           $Name<br>
  225.                           $Vorname<br>
  226.                           $Strasse<br>
  227.                           $PLZ<br>
  228.                           $Ort<br>
  229.                           <br><br>
  230.                           Vielen Dank für Ihre Bestellung und einen guten Appetit.<br>
  231.                           Ihr Pizza da Mamma Team<br>
  232.                           </font>
  233.                  ";
  234.                  $Subject="=?iso-8859-1?Q?".imap_8bit(trim("$betreff"))."?=";
  235.                  $email_body="$message";
  236.                  $header = "$Mail_From";
  237.                  $header .= "Content-Type: text/html; charset=iso-8859-1";
  238.                  if(mail($Mail_To,$Subject,$email_body,$header)){
  239.                  echo "<br>Ihre Bestellung wurde verschickt.<br>";
  240.                                   }else{
  241.                                   echo "<br>Fehler beim Senden.<br>";
  242.                                   }
  243.                  # SESSION löschen Warenkorb
  244.                  unset($_SESSION["KORB"]); unset($_SESSION["KORB_preis"]);
  245.  
  246.         }else{
  247.                  echo '<form action="#" method="post" name="bestellungform"><br>';
  248.                  echo 'Name:<br><input type="text" style="border:1px solid black; width:160px" name="Name" value=""><br><br>';
  249.                  echo 'Vorname:<br><input type="text" style="border:1px solid black; width:160px" name="Vorname" value=""><br><br>';
  250.                  echo 'Strasse:<br><input type="text" style="border:1px solid black; width:160px" name="Strasse" value=""><br><br>';
  251.                  echo 'PLZ:<br><input type="text" style="border:1px solid black; width:160px" name="PLZ" value=""><br><br>';
  252.                  echo 'Ort:<br><input type="text" style="border:1px solid black; width:160px" name="Ort" value=""><br><br>';
  253.                  echo 'E-Mail:<br><input type="text" style="border:1px solid black; width:160px" name="emailkunde" value=""><br><br>';
  254.                  echo 'Sonstiges:<br><textarea style="border:1px solid black; width:160px; height:100px" name="Sonstiges"></textarea><br><br>';
  255.                  echo '&nbsp; <input type="submit" name="bestellungsenden" class="formbutton" style="width:180px" value="Bestellung Senden"></form>';
  256.  
  257.  
  258.         }
  259.                 #####################################################################
  260.  
  261.     }else{
  262.         echo "Dein Warenkorb ist leer<br>";
  263.     }
  264.             ?>
  265.        <br><br><center>
  266.     </div>
  267.     <div id="footer">
  268.         &copy; 2010 Pizza da Mamma.  All rights reserved
  269.     </div>
  270.     <map name="Map" id="Map">
  271.         <area shape="rect" coords="110,2,128,63" href="#" />
  272.     </map>
  273.     <map name="Map2" id="Map2">
  274.         <area shape="rect" coords="109,1,126,65" href="#" />
  275.     </map>
  276.     <map name="Map3" id="Map3">
  277.         <area shape="rect" coords="111,2,127,67" href="#" />
  278.     </map>
  279.     <map name="Map4" id="Map4">
  280.         <area shape="rect" coords="112,0,128,64" href="#" />
  281.     </map>
  282.  <pre>
  283. <?php
  284. #rint_r($_GET);
  285. #print_r($_SESSION);
  286. ?>
  287. </pre>
  288. </body>
  289. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement