kod php
Kod php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | <?php include('../functions.php'); set_path('..'); include('session.php'); layout_begin(); $dajFormularz = true; $adresat = "tomek@fajnie.com\"; $litery_male_pl = \"±ćęłńó¶Ľż\"; $litery_duze_pl = \"ˇĆŁŃÓ¦¬Ż\"; $rozmiary = array( 'xxl', 'xl', 'l', 'm', 's', 'xs', 'xxs' ); $komunikat = \"\"; if( isset( $_POST['wysylamy'] ) ) { $dajFormularz = false; if( empty( $_POST['imieinazwisko'] ) ) { $dajFormularz = true; $komunikat .= \"<b>Brak nazwy zamawiaj±cego</b><br>\"; } if( empty( $_POST['adres'] ) ) { $dajFormularz = true; $komunikat .= \"<b>Brak adresu zamawiaj±cego</b><br>\"; } if( empty( $_POST['telefon'] ) ) { $dajFormularz = true; $komunikat .= \"<b>Brak numeru telefonu</b><br>\"; } $suma = 0; foreach( $rozmiary as $wartosc ) { $suma += (int)$_POST['r'.$wartosc]; } foreach( $rozmiary as $wartosc ) { if( !is_numeric( $_POST['r'.$wartosc] ) ) { $komunikat .= \"<b>Ilo¶ć sztuk musi być liczb±</b><br>\"; break; } } if( !is_numeric( $_POST['ilosc'] ) ) { $komunikat .= \"<b>Ilo¶ć sztuk musi być liczb±</b><br>\"; } if( $suma != $_POST['ilosc'] ) { $dajFormularz = true; $komunikat .= \"<b>Niezgodna ilo¶ć sztuk z ilo¶ci± zamawianych zestawów</b><br>\"; } if( empty( $_POST['email'] ) || !ereg(\"^[A-Z\".$GLOBALS['litery_duze_pl'].\"a-z\".$GLOBALS['litery_male_pl'].\"0-9._-]{1,}@[A-Z\".$GLOBALS['litery_duze_pl'].\"a-z\".$GLOBALS['litery_male_pl'].\"0-9_-]{1,}\.([A-Z\".$GLOBALS['litery_duze_pl'].\"a-z\".$GLOBALS['litery_male_pl'].\"0-9\_-]{1,}\.?){1,}$\", $_POST['email'] ) ) { $dajFormularz = true; $komunikat .= \"<b>Niepoprawny adres email</b><br>\"; } if( !empty( $komunikat ) ) { $komunikat .= \"<br><br>\"; } else //dane poprawne wysylami maila { if( $_POST['zestaw'] != '' ) { if( $_POST['zestaw'] > 0 ) $HIT = (($_POST['zestaw'] < 10)?\"0\":\"\").$_POST['zestaw']; } if( $_POST['radio1'] != '' ) { $dodatek = \" \".$_POST['radio1']; } srand( ( double )microtime() * 1000000 ); $marker = md5( uniqid( rand() ) ); $naglowek = \"From: Sklep\n\"; $naglowek .= \"Reply-to: \".$_POST['email'].\"\n\"; $naglowek .= \"Content-Type: multipart/mixed; \"; $naglowek .= \"boundary=\"\".$marker.\"\"\"; $tresc = \"--\".$marker.\"\n\"; $tresc .= \"Content-type: text/plain; charset=iso-8859-2\n\"; $tresc .= \"Content-Transfer-Encoding: 8bit\n\"; $tresc .= \"Content-Disposition: inline\n\"; $tresc .= \"Zamawiana ilo¶ć sztuk \".$_POST['ilosc'].\"\n\"; $tresc .= \"Zestaw HIT\".$HIT.$dodatek.\" \n\"; foreach( $rozmiary as $wartosc ) { if( $_POST['r'.$wartosc] != '' ) { $tresc .= \"Rozmiar \".strtoupper($wartosc).\" szt. \".$_POST['r'.$wartosc].\" numery \".$_POST['rn'.$wartosc].\"\n\"; } } if( $_POST['bramkarz'] == \"TAK\" ) { $tresc .= \"Dodatkowo zamówiony Komplet bramkarski\"; if( $HTTP_POST_FILES['plik']['error'] == 0 ) $tresc .= \"z reklam± na koszulce\"; $tresc .= \"\n\"; } $tresc .= \"\nDane zamawiaj±cego\n\"; $tresc .= \"Nazwa \".$_POST['imieinazwisko'].\"\n\"; $tresc .= \"Adres \".$_POST['adres'].\"\n\"; $tresc .= \"Nip \".$_POST['nip'].\"\n\"; $tresc .= \"Regon/PESEL \".$_POST['regon'].\"\n\"; $tresc .= \"Telefon \".$_POST['telefon'].\"\n\"; $tresc .= \"email \".$_POST['email'].\"\n\"; //tutaj ewentualny plik z reklam± if( $HTTP_POST_FILES['plik']['error'] == 0 && $_POST['bramkarz'] == \"TAK\" ) { $deskryptor = fopen( $HTTP_POST_FILES['plik']['tmp_name'], \"r\" ); $plik = fread( $deskryptor, filesize( $HTTP_POST_FILES['plik']['tmp_name'] ) ); fclose( $deskryptor ); $tresc .= \"--\".$marker.\"\n\"; $tresc .= \"Content-Type: \".$HTTP_POST_FILES['plik']['type'].\"; name=\"\".$HTTP_POST_FILES['plik']['name'].\"\"\n\"; $tresc .= \"Content-Transfer-Encoding: base64\n\"; $tresc .= \"Content-Description: \"Reklama na koszulkę\"\n\"; $tresc .= chunk_split( base64_encode( $plik ) ); } $tresc .= \"--\".$marker.\"--\"; //echo \"_\".mail( $adresat, \"Zamówienie\", $tresc, $naglowek).\"_\"; //echo \"<pre>\".$tresc.\"</pre>\"; mail( $adresat, \"Zamówienie\", $tresc, $naglowek); } } if( $dajFormularz ) { ?> |
a tak wyglada html