Advertisement
icedtea12

pizzadamammav03

Mar 14th, 2011
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.56 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.             $karte_array = array();
  131.             $zeilen = file ("karte.txt");
  132.             foreach ($zeilen as $zeile) {
  133.             list($id,$name,$gruppe,$preis,$einheit) = explode(";", $zeile);
  134.             $preis_array=explode(",", $preis);
  135.             $preisanzahl=count($preis_array);
  136.             $einheit_array=explode(",", $einheit);
  137.             $karte_array[$id]=$name;
  138.                  if((isset($_GET['anzeige']) && $gruppe == $_GET['anzeige']) || (!isset($_GET['anzeige']) && $gruppe == "pizza")){ #if($gruppe==$gruppe){ wenn alle gruppen angezeigt werden sollen
  139.                   # in SESSION speichern nach Senden
  140.                   if(isset($_POST[$id."_notizen"]) && $_POST[$id."_notizen"]!=""){
  141.                            $_SESSION["KORB"][$id."_".time()] = $_POST[$id."_notizen"];
  142.                            $_SESSION["KORB_preis"][$id."_".time()] = $_POST[$id."_preis"];
  143.                   }
  144.                   $outputradio="";
  145.                   if($preisanzahl == "1"){
  146.                           $outputradio="<input type='radio' name='".$id."_preis' value='".$preis."|".$einheit."'>".$preis." ".$einheit."<br>";
  147.                   }else{
  148.                           for($i=0; $i < count($preis_array);$i++){
  149.                           $outputradio.="<input type='radio' name='".$id."_preis' value='".$preis_array[$i]."|".$einheit_array[$i]."'>".$preis_array[$i]." ".$einheit_array[$i]."<br>";
  150.                           }
  151.                   }
  152.                   echo '<form action="#" method="post" name="form">';
  153.                   echo "".$id.". ".$name."<br>";
  154.                   echo '<input type="text" style="border:1px solid black; width:20px" maxlength="2" name="'.$id.'_notizen" value=""><br>';
  155.                   echo $outputradio;
  156.                   echo '&nbsp; <input type="submit" class="formbutton" style="width:180px" value="Anzahl speichern"></form>';
  157.                  }
  158.             }
  159.             ?>
  160.         </div>
  161.         <div id="notizen_anzeigen">
  162.                <center><b>DEIN WARENKORB</b><br /></center><br>
  163.                <?php
  164.                 # unset($_SESSION["KORB"]); unset($_SESSION["KORB_preis"]);
  165.             $_SESSION["BESTELLUNG"]="";
  166.     if(isset($_SESSION["KORB"])){
  167.                   #############################
  168.                   # Warenkorb +/-/x verarbeitung
  169.                  if(isset($_GET["key"]) && isset($_GET["plus"])){
  170.                   $_SESSION["KORB"][$_GET["key"]]=($_SESSION["KORB"][$_GET["key"]]+1);
  171.                  }elseif(isset($_GET["key"]) && isset($_GET["minus"])){
  172.                     $_SESSION["KORB"][$_GET["key"]]=((float)$_SESSION["KORB"][$_GET["key"]]-1);
  173.                     if($_SESSION["KORB"][$_GET["key"]]<"1"){
  174.                      unset($_SESSION["KORB"][$_GET["key"]]);
  175.                     }
  176.                  }elseif(isset($_GET["key"]) && isset($_GET["raus"])){
  177.                     unset($_SESSION["KORB"][$_GET["key"]]);
  178.                  }
  179.                   # Warenkorb +/-/x verarbeitung
  180.                   #############################
  181.                 echo "<small>";
  182.                 # alle Daten aus SESSION Anzeigen
  183.                 ksort ($_SESSION["KORB"]);
  184.                 ksort ($_SESSION["KORB_preis"]);
  185.                 $preisges="";
  186.                 foreach($_SESSION["KORB"] as $key => $value){
  187.                 list($PREIS,$EINHEIT) = explode("|", $_SESSION['KORB_preis'][$key]);
  188.                  $preis =($value*$PREIS);
  189.                 echo
  190.                 $karte_array[trim(preg_replace('/_[\d]*$/', ' ', $key))]."
  191.                 ".$EINHEIT
  192.                 #$key
  193.                 .": ".$value." x ".$PREIS." = ".number_format($preis, 2, '.', '');
  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.  
  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.                  $betreff="Ihre Bestellung bei Pizza da Mamma";
  215.                  $Mail_To = "pizzadamamma.kontakt@bluewin.ch, $emailkunde";
  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.                           $_SESSION[BESTELLUNG]
  221.                           <br>
  222.                           Kundendaten:<br>
  223.                           $Name<br>
  224.                           $Vorname<br>
  225.                           $Strasse<br>
  226.                           $PLZ<br>
  227.                           $Ort<br>
  228.                           <br><br>
  229.                           Vielen Dank für Ihre Bestellung und einen guten Appetit.<br>
  230.                           Ihr Pizza da Mamma Team<br>
  231.                           </font>
  232.                  ";
  233.                  $Subject="=?iso-8859-1?Q?".imap_8bit(trim("$betreff"))."?=";
  234.                  $email_body="$message";
  235.                  $header = "$Mail_From";
  236.                  $header .= "Content-Type: text/html; charset=iso-8859-1";
  237.  
  238.                  # Lokal geht mail() nicht, nur Online im Web
  239.                  if($_SERVER['SERVER_NAME'] == "localhost"){
  240.                           # Testausgabe wenn Lokal
  241.                           echo "<i>".$message."</i>";
  242.                           }else{
  243.                           mail($Mail_To,$Subject,$email_body,$header);
  244.                           }
  245.                  echo "";
  246.                  # SESSION löschen Warenkorb
  247.                  unset($_SESSION["KORB"]); unset($_SESSION["KORB_preis"]);
  248.  
  249.         }else{
  250.                  echo '<form action="#" method="post" name="bestellungform"><br>';
  251.                  echo 'Name:<br><input type="text" style="border:1px solid black; width:160px" name="Name" value=""><br><br>';
  252.                  echo 'Vorname:<br><input type="text" style="border:1px solid black; width:160px" name="Vorname" value=""><br><br>';
  253.                  echo 'Strasse:<br><input type="text" style="border:1px solid black; width:160px" name="Strasse" value=""><br><br>';
  254.                  echo 'PLZ:<br><input type="text" style="border:1px solid black; width:160px" name="PLZ" value=""><br><br>';
  255.                  echo 'Ort:<br><input type="text" style="border:1px solid black; width:160px" name="Ort" value=""><br><br>';
  256.                  echo 'E-Mail:<br><input type="text" style="border:1px solid black; width:160px" name="emailkunde" value=""><br><br>';
  257.                  echo 'Sonstiges:<br><textarea style="border:1px solid black; width:160px; height:100px" name="Sonstiges"></textarea><br><br>';
  258.                  echo '&nbsp; <input type="submit" name="bestellungsenden" class="formbutton" style="width:180px" value="Bestellung Senden"></form>';
  259.  
  260.  
  261.         }
  262.                 #####################################################################
  263.  
  264.     }else{
  265.         echo "Dein Warenkorb ist leer<br>";
  266.     }
  267.             ?>
  268.        <br><br><center>
  269.     </div>
  270.     <div id="footer">
  271.         &copy; 2010 Pizza da Mamma.  All rights reserved
  272.     </div>
  273.     <map name="Map" id="Map">
  274.         <area shape="rect" coords="110,2,128,63" href="#" />
  275.     </map>
  276.     <map name="Map2" id="Map2">
  277.         <area shape="rect" coords="109,1,126,65" href="#" />
  278.     </map>
  279.     <map name="Map3" id="Map3">
  280.         <area shape="rect" coords="111,2,127,67" href="#" />
  281.     </map>
  282.     <map name="Map4" id="Map4">
  283.         <area shape="rect" coords="112,0,128,64" href="#" />
  284.     </map>
  285.  <pre>
  286. <?php
  287. #rint_r($_GET);
  288. #print_r($_SESSION);
  289. ?>
  290. </pre>
  291. </body>
  292. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement