"; } If(trim($youremail)=="") { $error.="Вы не ввели Ваш email!
"; } Elseif(!eregi("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$",$youremail)) { $error.="Неправильный адрес электронной почты
"; } If(trim($emailsubject)=="") { $emailsubject=$defaultsubject; } If(trim($yourmessage)=="") { $error.="Вы не ввели Ваше сообщение!
"; } If($allowattach > 0) { //Loopish For($i=0; $i <= $allowattach-1; $i++) { If($_FILES['attachment']['name'][$i]) { $ext=get_ext($_FILES['attachment']['name'][$i]); $size=$_FILES['attachment']['size'][$i]; $max_bytes=$max_file_size*1024; //Check if the file type uploaded is a valid file type. If(!in_array($ext, $allowtypes)) { $error.= "Недопустимое расширение для вашего файла: ".$_FILES['attachment']['name'][$i].", only ".$types." are allowed.
"; //Check the size of each file } Elseif($size > $max_bytes) { $error.= "Ваш файл: ".$_FILES['attachment']['name'][$i]." is to big. Max file size is ".$max_file_size."kb.
"; } } // If Files } // For //Tally the size of all the files uploaded, check if it's over the ammount. $total_size=array_sum($_FILES['attachment']['size']); $max_file_total_bytes=$max_file_total*1024; If($total_size > $max_file_total_bytes) { $error.="Максимальный допустимый размер вашего файла ".$max_file_total."kb
"; } } // If Allowattach If($error) { $display_message=$error; } Else { If($use_subject_drop AND is_array($subjects) AND is_array($emails)) { $subject_count=count($subjects); $email_count=count($emails); If($subject_count==$email_count) { $myemail=$emails[$emailsubject]; $emailsubject=$subjects[$emailsubject]; } } $boundary=md5(uniqid(time())); $yourname=clean($yourname); $yourmessage=clean($yourmessage); $youremail=clean($youremail); $headers="From: ".$yourname." <".$youremail.">\n"; $headers.="Reply-To: ".$yourname." <".$youremail.">\n"; $headers.="MIME-Version: 1.0\n"; $headers.="Content-Type: multipart/mixed; boundary=\"".$boundary."\"\n"; $headers.="X-Sender: ".$_SERVER['REMOTE_ADDR']."\n"; $headers.="X-Mailer: PHP/".phpversion()."\n"; $headers.="X-Priority: ".$priority."\n"; $headers.="Return-Path: <".$youremail.">\n"; $headers.="This is a multi-part message in MIME format.\n"; //Message $message = "--".$boundary."\n"; $message.="Content-Type: text/plain; charset=\"windows-1251\"\n"; $message.="Content-Transfer-Encoding: quoted-printable\n"; $message.="\n"; $message.="$yourmessage"; $message.="\n"; //Lets attach to something! =) If($allowattach > 0) { For($i=0; $i <= $allowattach-1; $i++) { If($_FILES['attachment']['name'][$i]) { $message.=phattach($_FILES['attachment']['tmp_name'][$i],$_FILES['attachment']['name'][$i]); } } //For } // If // End the message $message.="--".$boundary."--\n"; // Send the completed message If(!mail($myemail,$emailsubject,$message,$headers)) { Exit("Произошла ошибка, пожалуйста, сообщите об этом администратору сайта.\n"); } Else { $sent_mail=true; } } // Else } // $_POST ?> <?=$websitename?>