3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //Include the database include ('../media/connect_mysql.php'); ### Konfiguration ### # Bitte passen Sie die folgenden Werte an, bevor Sie das Script benutzen! # An welche Adresse sollen die Mails gesendet werden? $strEmpfaenger = 'mail@hexdesign.de'; # Welche Adresse soll als Absender angegeben werden? # (Manche Hoster lassen diese Angabe vor dem Versenden der Mail ueberschreiben) $strFrom = '"Homepage Terra-Roxa" <terrarox@pt.lu>'; # Welchen Betreff sollen die Mails erhalten? $strSubject = 'Bestellung von Terra-Roxa Homepage'; # Zu welcher Seite soll als "Danke-Seite" weitergeleitet werden? # Wichtig: Sie muessen hier eine gueltige HTTP-Adresse angeben! $strReturnhtml = 'http://www.terra-roxa.com/media/danke.htm'; # Welche(s) Zeichen soll(en) zwischen dem Feldnamen und dem angegebenen Wert stehen? $strDelimiter = " : "; $ip=$_SERVER["REMOTE_ADDR"]; echo mysql_error(); ### Ende Konfiguration ### if($_POST) { $strMailtext = ""; $strMailtext .= "\n" . "Un ordre de " . $_POST["firma_rechnung"] . "\n" . "\n" . "Adresse De facturation \n" . "\n" . " Nom: " . $_POST["name_rechnung"] . "\n" . " Adresse: " . $_POST["strasse_rechnung"] . "\n" . " Code postal: " . $_POST["plz_rechnung"] . "\n" . " Ville: " . $_POST["ort_rechnung"] . "\n" . " Téléphone: " . $_POST["telefon_rechnung"] . "\n" . " Email: " . $_POST["email_rechnung"] . "\n" . "\n" . "Votre message: " . $_POST["message"] . "\n" . "\n" . "Adresse de livraison (si différente)\n" . "\n" . " Adresse: " . $_POST["strasse_lieferung"] . "\n" . " Code postal: " . $_POST["plz_lieferung"] . "\n" . " Ville: " . $_POST["ort_lieferung"] . "\n" . "\n" . "IP-Adresse: " . $ip . "\n" . "\n"; echo mysql_error(); while(list($strName,$value) = each($_POST)) { if(is_array($value)) { foreach($value as $value_array) { $strMailtext = str_replace("_", " ", $strMailtext); $strMailtext .= $strDelimiter."\n"; } } elseif ($value != '0') { unset($_POST["firma_rechnung"]); unset($_POST["name_rechnung"]); unset($_POST["strasse_rechnung"]); unset($_POST["plz_rechnung"]); unset($_POST["ort_rechnung"]); unset($_POST["telefon_rechnung"]); unset($_POST["email_rechnung"]); unset($_POST["message"]); unset($_POST["strasse_lieferung"]); unset($_POST["plz_lieferung"]); unset($_POST["ort_lieferung"]); $strMailtext = str_replace("_", " ", $strMailtext); $strMailtext .= $strName. " Pièces par colis " .$strDelimiter.$value. " carton(s) \n"; $strMailtext = str_replace("_", " ", $strMailtext); } } if(get_magic_quotes_gpc()) { $strMailtext = stripslashes($strMailtext); } mail($strEmpfaenger, $strSubject, $strMailtext, "From: ".$strFrom) or die("Die Mail konnte nicht versendet werden."); header("Location: $strReturnhtml"); exit; } $manufact = array("Biscuits Filet Bleu","Chocolat Schönenberger AG","Confiserie De Fries","Confiserie Mathez","Dimabel bvba","dwp e.g.","Ethiquable","Fair Naturally","Fair Squared GmbH","Fair Wein GmbH","Gepa","Idé Coffee Systems","KeyPharm Laboratories","Label Place","Maya Fair trade","Moulin J.P. Dieschburg","Natur'Inov","NJD COSMETICS","Oxfam Fair trade","Savonnerie Marius FABRE","Vermeiren Princeps"); $label = array("DWP","ECOcert","Fair+bio","Fairtrade","Gepa Fair+","Max Havelaar","Naturland Fair","Oxfam Fairtrade","Transfair"); $q = "SELECT a.product_id, a.product_sku, a.product_s_desc, a.product_special, a.product_name, a.product_packaging, b.product_id, b.product_price, b.shopper_group_id, c.product_id, c.manufacturer_id, d.manufacturer_id, d.mf_name, e.category_id, e.category_name, f.category_id, f.product_id FROM jos_vm_product AS a, jos_vm_product_price AS b, jos_vm_product_mf_xref AS c, jos_vm_manufacturer AS d, jos_vm_category AS e, jos_vm_product_category_xref AS f WHERE a.product_id = b.product_id AND a.product_id = f.product_id AND e.category_id = f.category_id AND b.product_id = c.product_id AND b.shopper_group_id = '5' AND NOT c.manufacturer_id = '186' AND c.manufacturer_id = d.manufacturer_id ORDER BY d.mf_name, e.category_name, b.product_id"; $result = mysql_query($q, $link); echo mysql_error(); $max = 50; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <title>Bestellformular Terra-Roxa</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style> p { border-bottom: 2px solid #990000; background-color: #CCCCCC; padding: 0px; clear: both; } </style> <script type="text/javascript"> function berechnen() { erg = document.getElementById('$row[feld1]').value * document.getElementById('$row[feld2]').value; document.getElementById('$row[ergebnis]').innerHTML = erg; } </script> </head> <body> <form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post" name="autoSumForm"> <!-- Hier die eigentlichen Formularfelder eintragen. Die folgenden sind Beispielangaben. --> <hr align="left" color="#990000" size="2" width="550"> <table width="550" border="0" bgcolor="#CCCCCC"> <tr> <td colspan="2" height="30"><b>Adresse de facturation</b></td> </tr> <tr> <td align="left" width="200">Société:</td> <td align="left" width="220"><input type="text" size="30" name="firma_rechnung"></td> </tr> <tr> <td align="left" width="200">Votre nom:</td> <td align="left" width="220"><input type="text" size="30" name="name_rechnung"></td> </tr> <tr> <td align="left" width="200">Votre rue:</td> <td align="left" width="220"><input type="text" size="30" name="strasse_rechnung"></td> </tr> <tr> <td align="left" width="200">Votre code postal:</td> <td align="left" width="220"><input type="text" size="30" name="plz_rechnung" placeholder="12345"></td> </tr> <tr> <td align="left" width="200">Votre lieu:</td> <td align="left" width="220"><input type="text" size="30" name="ort_rechnung"></td> </tr> <tr> <td align="left" width="200">Votre téléphone:</td> <td align="left" width="220"><input type="text" size="30" name="telefon_rechnung"></td> </tr> <tr> <td align="left" width="200">Votre E-Mail:</td> <td align="left" width="220"><input type="text" size="30" name="email_rechnung"></td> </tr> <tr> <td align="left" width="200">Message:</td> <td colspan="4" width="300"><textarea name="message" size="300" rows="6" cols="59">Message</textarea></td> </tr> </table> <hr align="left" color="#990000" size="2" width="550"> <table width="550" border="0" bgcolor="#CCCCCC"> <tr> <td colspan="2" height="30"><b>Adresse de livraison (si différente)</b></td> </tr> <tr> <td align="left" width="200">Votre rue:</td> <td align="left" width="220"><input type="text" size="30" name="strasse_lieferung"></td> </tr> <tr> <td align="left" width="200">Votre code postal:</td> <td align="left" width="220"><input type="text" size="30" name="plz_lieferung" placeholder="12345"></td> </tr> <tr> <td align="left" width="200">Votre lieu:</td> <td align="left" width="220"><input type="text" size="30" name="ort_lieferung"></td> </tr> </table> <hr align="left" color="#990000" size="2" width="550"> <br> <table> <tr> <td><p>Produits fair-trade triés par fournisseur et catégorie</p></td> </tr> </table> <table border="0"> <tr> <td width="120"><p>Code article</p></td> <td width="320"><p>Désignation</p></td> <td width="150"><p>Label</p></td> <td width="150"><p>Pièces par colis</p></td> <td width="150"><p>Carton</p></td> <td width="150"><p>Paquet</p></td> </tr> </table> <?php while($row = mysql_fetch_array($result)) { $stueck = ''; $feld1 = $row['feld1']; $feld2 = $row['feld2']; $ergebnis = $row['ergebnis']; $category_name = $row['category_name']; $category_id = $row['category_id']; $product_id = $row['product_id']; $product_sku = $row['product_sku']; $product_special = $row['product_special']; $product_s_desc = $row['product_s_desc']; if ($product_special == 'N') { $product_special = '-'; } else { $product_special = 'Bio'; } $product_s_desc = $row['product_s_desc']; if ($product_s_desc == '0') { $product_s_desc = '-'; } else { $product_s_desc = $product_s_desc; } $mf_name = $row['mf_name']; $product_name = $row['product_name']; $product_packaging = $row['product_packaging']; $product_packaging .= " paquets"; $product_price = number_format($row['product_price'], 2, ',', ' '); $product_price .= ' €'; $shopper_group_id = $row['shopper_group_id']; if ($product_s_desc != '') { if ( $category_id == $category_id_old OR $category_name == $category_name_old ) { echo "<table border='0'>"; echo "<tr>"; echo "<td width='120'>" . $row[product_sku] . "</td>"; echo "<td width='320'>" . $row[product_name] . "</td>"; echo "<td width='150'>" . $row[product_s_desc] . "</td>"; echo "<td width='150'>" . $row[product_packaging] . " Pièces par colis</td><input type='hidden' id='$row[feld1]' value='$row[product_packaging]' onChange='berechnen()'>"; echo "<td width='150'><input id='$row[feld2]' type='number' maxlength='3' size='1' name='$row[product_sku] $row[product_name] \t' value='0' onChange='berechnen()'></td>"; echo "<td width='150'><div id='row$[ergebnis]'></div></td>"; echo "</table>"; } else { if ( $mf_name != $mf_name_old) { echo "<table border='0'>"; echo "<tr>"; echo "<td width='910'><p>" . $row[mf_name] . "</p></td>"; echo "</tr>"; echo "</table>"; } else { $y_axis = $y_axis; } echo "<table border='0'>"; echo "<tr>"; echo "<td width='910' bgcolor='#CCCCCC'>" . $row[category_name] . "</td>"; echo "</tr>"; echo "</table>"; echo "<table border='0'>"; echo "<tr>"; echo "<td width='120'>" . $row[product_sku] . "</td>"; echo "<td width='320'>" . $row[product_name] . "</td>"; echo "<td width='150'>" . $row[product_s_desc] . "</td>"; echo "<td width='150'>" . $row[product_packaging] . " Pièces par colis</td><input type='hidden' id='$row[feld1]' value='$row[product_packaging]' onChange='berechnen()'>"; echo "<td width='150'><input id='$row[feld2]' type='number' maxlength='3' size='1' name='$row[product_sku] $row[product_name] \t' value='0' onChange='berechnen()'></td>"; echo "<td width='150'><div id='$row[ergebnis]'></div></td>"; } } $y_axis = $y_axis + 3; $i = $i + 1; $category_id_old = $category_id; $category_name_old = $category_name; $mf_name_old = $mf_name; $feld1 = $feld1 + 1; $feld2 = $feld2 + 1; $ergebnis = $ergebnis + 1; } echo mysql_error(); mysql_close($link); ?> <br><br> <input type="submit" value="Absenden / Envoyer" /> <input type="reset" value="Reset / Effacer" /> </form> <br><br><br> </body> </html>
Output for 7.0.0 - 7.2.0
Warning: include(../media/connect_mysql.php): failed to open stream: No such file or directory in /in/XhOTC on line 4 Warning: include(): Failed opening '../media/connect_mysql.php' for inclusion (include_path='.:') in /in/XhOTC on line 4 Notice: Undefined index: REMOTE_ADDR in /in/XhOTC on line 27 Fatal error: Uncaught Error: Call to undefined function mysql_error() in /in/XhOTC:28 Stack trace: #0 {main} thrown in /in/XhOTC on line 28
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Warning: include(../media/connect_mysql.php): failed to open stream: No such file or directory in /in/XhOTC on line 4 Warning: include(): Failed opening '../media/connect_mysql.php' for inclusion (include_path='.:') in /in/XhOTC on line 4 Notice: Undefined index: REMOTE_ADDR in /in/XhOTC on line 27 Fatal error: Call to undefined function mysql_error() in /in/XhOTC on line 28
Process exited with code 255.