На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
! Правила раздела
1. Не создавайте несколько одинаковых тем, ибо модератор может расценить их, как спам и удалить все.
2. Для решения задач по GPSS есть отдельная тема. Все задачи по GPSS опубликовывать в этой теме! Перед опубликовыванием вашей задачи просмотрите всю тему, возможно вы сразу найдете решение.
3. Давайте вашим темам ОСМЫСЛЕННЫЕ названия, а также указывайте язык программирования. Пример: [Pascal]:Работа с файлами и записями.
4. Использования тега CODE обязательно при публикации текста программы.

Темы, оформленные с явным игнорированием правил и отсутствием смысла, будут закрыты/удалены!
Вам помогли? Напишите об этом здесь (в портфолио фрилансера)

Фрилансерам:
5. Демпинг цен запрещен (даже если Вы готовы работать бесплатно). Цены обсуждаются в приватном общении. Если вы готовы рещить задачу бесплатно, просто решите ее быстрее, чем возникнет предложение сделать это за деньги.
6. Пользователям, входящим в группу Newbie, запрещается предлагать свои услуги (завуалированно в т.ч.)
7. В посте с предложением выполнить работу, обязательно указывать ссылку на свое портфолио в Отзывы, Благодарности, Портфолио Это правило работает и в том случае, если вы выполняете работу бесплатно.
8. Реклама (даже завуалированная) своих фриланских сайтов запрещена

Нарушение данных пунктов влечет до RO или БАНА (при неоднократом)
Модераторы: ttiger, mikefreelance, Rust
  
    > HTML форма через PHP , форма почтой HTML&PHP
      Ребята помогите я с PHP не дружу.
      Надо в PHP что ниже дописать код, там через PHP можно отправить только один аттач, а мне надо чтоб 5.

      Это HTML форма которая отправляется с сайта я не нужное вырезал:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd">
      <html>
      <head>
      <title>Untitled Document</title>
      <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
      <style type="text/css">
      <!--
      body {
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
      }
      .style1 {
      color: #FF0000;
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-weight: bold;
      font-size: 9px;

      -->
      </style></head>

      <body>
      <div align="center">
      <table width="650" height="1400" border="0" cellpadding="0" cellspacing="0">
      <form method="post" enctype="multipart/form-data" action="http://www.my.com/cgi-script/formmail.php">
      <input type="hidden" name="path_to_file" value="/www/uploaded/files">
      <input type="hidden" name="require" value="name">
      <input type="hidden" name="recipient" value="info@my.com">
      <input type="hidden" name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT,REMOTE_ADDR">
      ЗДЕСЬ ТИПА ЕЩЕ ВСЯКИЕ ПУНКТЫ В ТАБЛИЦЕ
      А вот и сама загвоздка отправки этих 5 фото
      <tr>
      <td class="style1"><div align="right">Фото 1:</div></td>
      <td><div align="left">
      <input name="attachment" type="file" id="photo1" size="35">
      </div></td>
      </tr>
      <tr>
      <td class="style1"><div align="right">Фото 2:</div></td>
      <td><div align="left">
      <input name="attachment2" type="file" id="photo2" size="35">
      </div></td>
      </tr>
      <tr>
      <td class="style1"><div align="right">Фото 3:</div></td>
      <td><div align="left">
      <input name="attachment3" type="file" id="photo3" size="35">
      </div></td>
      </tr>
      <tr>
      <td class="style1"><div align="right">Фото 4:</div></td>
      <td><div align="left">
      <input name="attachment4" type="file" id="photo4" size="35">
      </div></td>
      </tr>
      <tr>
      <td class="style1"><div align="right">Фото 5:</div></td>
      <td><div align="left">
      <input name="attachment5" type="file" id="photo5" size="35">
      </div></td>
      </tr>
      </table>
      ЗДЕСЬ ТОЖЕ ЕЩЕ ВСЯКОЕ НАПИСАНО
      </form>
      ЗДЕСЬ ТОЖЕ ЕЩЕ ВСЯКОЕ НАПИСАНО
      </body>
      </html>

      А вот и PHP, в PHP ничего не вырезал это весь код который сейчас есть

      <?

      $recipient = "info@my.com"; // info@my.com


      $bcc = "";


      $referers = array ('my.com','www.my.com.','191.150.0.221');


      $banlist = array ('*@somedomain.com', 'user@domain.com', 'etc@domains.com');


      define("SEPARATOR", ($separator)?$separator:": ");


      define("NEWLINE", ($newline)?$newline:"\n");


      define("VERSION", "5.0");


      function print_error($reason,$type = 0) {
      build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet);

      if ($type == "missing") {
      if ($missing_field_redirect) {
      header("Location: $missing_field_redirect?error=$reason");
      exit;
      } else {
      ?>
      The form was not submitted for the following reasons:<p>
      <ul><?
      echo $reason."\n";
      ?></ul>
      Please use your browser's back button to return to the form and try again.<?
      }
      } else {
      ?>
      The form was not submitted because of the following reasons:<p>
      <?
      }
      echo "<br><br>\n";
      echo "<small></small>\n\n";
      exit;
      }

      function check_banlist($banlist, $email) {
      if (count($banlist)) {
      $allow = true;
      foreach($banlist as $banned) {
      $temp = explode("@", $banned);
      if ($temp[0] == "*") {
      $temp2 = explode("@", $email);
      if (trim(strtolower($temp2[1])) == trim(strtolower($temp[1])))
      $allow = false;
      } else {
      if (trim(strtolower($email)) == trim(strtolower($banned)))
      $allow = false;
      }
      }
      }
      if (!$allow) {
      print_error("You are using from a <b>banned email address.</b>");
      }
      }

      function check_referer($referers) {
      if (count($referers)) {
      $found = false;

      $temp = explode("/",getenv("HTTP_REFERER"));
      $referer = $temp[2];

      if ($referer=="") {$referer = $_SERVER['HTTP_REFERER'];
      list($remove,$stuff)=split('//',$referer,2);
      list($home,$stuff)=split('/',$stuff,2);
      $referer = $home;
      }

      for ($x=0; $x < count($referers); $x++) {
      if (eregi ($referers[$x], $referer)) {
      $found = true;
      }
      }
      if ($referer =="")
      $found = false;
      if (!$found){
      print_error("You are coming from an <b>unauthorized domain.</b>");
      error_log("[FormMail.php] Illegal Referer. (".getenv("HTTP_REFERER").")", 0);
      }
      return $found;
      } else {
      return true;
      }
      }
      if ($referers)
      check_referer($referers);

      if ($banlist)
      check_banlist($banlist, $email);

      function parse_form($array, $sort = "") {

      $reserved_keys[] = "MAX_FILE_SIZE";
      $reserved_keys[] = "required";
      $reserved_keys[] = "redirect";
      $reserved_keys[] = "require";
      $reserved_keys[] = "path_to_file";
      $reserved_keys[] = "recipient";
      $reserved_keys[] = "subject";
      $reserved_keys[] = "sort";
      $reserved_keys[] = "style_sheet";
      $reserved_keys[] = "bgcolor";
      $reserved_keys[] = "text_color";
      $reserved_keys[] = "link_color";
      $reserved_keys[] = "vlink_color";
      $reserved_keys[] = "alink_color";
      $reserved_keys[] = "title";
      $reserved_keys[] = "missing_fields_redirect";
      $reserved_keys[] = "env_report";
      $reserved_keys[] = "submit";
      if (count($array)) {
      if (is_array($sort)) {
      foreach ($sort as $field) {
      $reserved_violation = 0;
      for ($ri=0; $ri<count($reserved_keys); $ri++)
      if ($array[$field] == $reserved_keys[$ri]) $reserved_violation = 1;

      if ($reserved_violation != 1) {
      if (is_array($array[$field])) {
      for ($z=0;$z<count($array[$field]);$z++)
      $content .= $field.SEPARATOR.$array[$field][$z].NEWLINE;
      } else
      $content .= $field.SEPARATOR.$array[$field].NEWLINE;
      }
      }
      }
      while (list($key, $val) = each($array)) {
      $reserved_violation = 0;
      for ($ri=0; $ri<count($reserved_keys); $ri++)
      if ($key == $reserved_keys[$ri]) $reserved_violation = 1;

      for ($ri=0; $ri<count($sort); $ri++)
      if ($key == $sort[$ri]) $reserved_violation = 1;

      if ($reserved_violation != 1) {
      if (is_array($val)) {
      for ($z=0;$z<count($val);$z++)
      $content .= $key.SEPARATOR.$val[$z].NEWLINE;
      } else
      $content .= $key.SEPARATOR.$val.NEWLINE;
      }
      }
      }
      return $content;
      }

      function mail_it($content, $subject, $email, $recipient) {
      global $attachment_chunk, $attachment_name, $attachment_type, $attachment_sent, $bcc;

      $ob = "----=_OuterBoundary_000";
      $ib = "----=_InnerBoundery_001";

      $headers = "MIME-Version: 1.0\r\n";
      $headers .= "From: ".$email."\n";
      $headers .= "To: ".$recipient."\n";
      $headers .= "Reply-To: ".$email."\n";
      if ($bcc) $headers .= "Bcc: ".$bcc."\n";
      $headers .= "X-Priority: 1\n";
      $headers .= "X-Mailer: DT Formmail".VERSION."\n";
      $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"".$ob."\"\n";


      $message = "This is a multi-part message in MIME format.\n";
      $message .= "\n--".$ob."\n";
      $message .= "Content-Type: multipart/alternative;\n\tboundary=\"".$ib."\"\n\n";
      $message .= "\n--".$ib."\n";
      $message .= "Content-Type: text/plain;\n\tcharset=\"windows-1251\"\n";
      $message .= "Content-Transfer-Encoding: quoted-printable\n\n";
      $message .= $content."\n\n";
      $message .= "\n--".$ib."--\n";
      if ($attachment_name && !$attachment_sent) {
      $message .= "\n--".$ob."\n";
      $message .= "Content-Type: $attachment_type;\n\tname=\"".$attachment_name."\"\n";
      $message .= "Content-Transfer-Encoding: base64\n";
      $message .= "Content-Disposition: attachment;\n\tfilename=\"".$attachment_name."\"\n\n";
      $message .= $attachment_chunk;
      $message .= "\n\n";
      $attachment_sent = 1;
      }
      $message .= "\n--".$ob."--\n";

      mail($recipient, $subject, $message, $headers);
      }

      function build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet) {
      if ($style_sheet)
      echo "<LINK rel=STYLESHEET href=\"$style_sheet\" Type=\"text/css\">\n";
      if ($title)
      echo "<title>$title</title>\n";
      if (!$bgcolor)
      $bgcolor = "#FFFFFF";
      if (!$text_color)
      $text_color = "#000000";
      if (!$link_color)
      $link_color = "#0000FF";
      if (!$vlink_color)
      $vlink_color = "#FF0000";
      if (!$alink_color)
      $alink_color = "#000088";
      if ($background)
      $background = "background=\"$background\"";
      echo "<body bgcolor=\"$bgcolor\" text=\"$text_color\" link=\"$link_color\" vlink=\"$vlink_color\" alink=\"$alink_color\" $background>\n\n";
      }

      $recipient_in = split(',',$recipient);
      for ($i=0;$i<count($recipient_in);$i++) {
      $recipient_to_test = trim($recipient_in[$i]);
      if (!eregi("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,6}$", $recipient_to_test)) {
      print_error("<b>I NEED VALID RECIPIENT EMAIL ADDRESS ($recipient_to_test) TO CONTINUE</b>");
      }
      }

      if ($required)
      $require = $required;

      if ($require) {

      $require = ereg_replace( " +", "", $require);
      $required = split(",",$require);
      for ($i=0;$i<count($required);$i++) {
      $string = trim($required[$i]);

      if((!(${$string})) || (!(${$string}))) {

      if ($missing_fields_redirect) {
      header ("Location: $missing_fields_redirect");
      exit;
      }
      $require;
      $missing_field_list .= "<b>Missing: $required[$i]</b><br>\n";
      }
      }

      if ($missing_field_list)
      print_error($missing_field_list,"missing");
      }

      if (($email) || ($EMAIL)) {
      $email = trim($email);
      if ($EMAIL) $email = trim($EMAIL);
      if (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email))
      print_error("your <b>email address</b> is invalid");
      $EMAIL = $email;
      }

      if (($ZIP_CODE) || ($zip_code)) {
      $zip_code = trim($zip_code);
      if ($ZIP_CODE) $zip_code = trim($ZIP_CODE);
      if (!ereg("(^[0-9]{5})-([0-9]{4}$)", trim($zip_code)) && (!ereg("^[a-zA-Z][0-9][a-zA-Z][[:space:]][0-9][a-zA-Z][0-9]$", trim($zip_code))) && (!ereg("(^[0-9]{5})", trim($zip_code))))
      print_error("your <b>zip/postal code</b> is invalid");
      }

      if (($PHONE_NO) || ($phone_no)) {
      $phone_no = trim($phone_no);
      if ($PHONE_NO) $phone_no = trim($PHONE_NO);
      if (!ereg("(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)", $phone_no))
      print_error("your <b>phone number</b> is invalid");
      }

      if (($FAX_NO) || ($fax_no)) {
      $fax_no = trim($fax_no);
      if ($FAX_NO) $fax_no = trim($FAX_NO);
      if (!ereg("(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)", $fax_no))
      print_error("your <b>fax number</b> is invalid");
      }

      if ($sort == "alphabetic") {
      uksort($HTTP_POST_VARS, "strnatcasecmp");
      } elseif ((ereg('^order:.*,.*', $sort)) && ($list = explode(',', ereg_replace('^order:', '', $sort)))) {
      $sort = $list;
      }

      $content = parse_form($HTTP_POST_VARS, $sort);

      if ($attachment_name) {
      if ($attachment_size > 0) {
      if (!$attachment_type) $attachment_type = "application/unknown";
      $content .= "Attached File: ".$attachment_name."\n";
      $fp = fopen($attachment, "r");
      $attachment_chunk = fread($fp, filesize($attachment));
      $attachment_chunk = base64_encode($attachment_chunk);
      $attachment_chunk = chunk_split($attachment_chunk);
      }
      }

      if ($file_name) {
      if ($file_size > 0) {
      if (!ereg("/$", $path_to_file))
      $path_to_file = $path_to_file."/";
      $location = $path_to_file.$file_name;
      if (file_exists($path_to_file.$file_name))
      $location = $path_to_file.rand(1000,3000).".".$file_name;
      copy($file,$location);
      unlink($file);
      $content .= "Uploaded File: ".$location."\n";
      }
      }

      if ($file2_name) {
      if ($file_size > 0) {
      if (!ereg("/$", $path_to_file))
      $path_to_file = $path_to_file."/";
      $location = $path_to_file.$file2_name;
      if (file_exists($path_to_file.$file2_name))
      $location = $path_to_file.rand(1000,3000).".".$file2_name;
      copy($file2,$location);
      unlink($file2);
      $content .= "Uploaded File: ".$location."\n";
      }
      }

      if ($env_report) {
      $env_report = ereg_replace( " +", "", $env_report);
      $env_reports = split(",",$env_report);
      $content .= "\n------ eviromental variables ------\n";
      for ($i=0;$i<count($env_reports);$i++) {
      $string = trim($env_reports[$i]);
      if ($env_reports[$i] == "REMOTE_HOST")
      $content .= "REMOTE HOST: ".$REMOTE_HOST."\n";
      if ($env_reports[$i] == "REMOTE_USER")
      $content .= "REMOTE USER: ". $REMOTE_USER."\n";
      if ($env_reports[$i] == "REMOTE_ADDR")
      $content .= "REMOTE ADDR: ". $REMOTE_ADDR."\n";
      if ($env_reports[$i] == "HTTP_USER_AGENT")
      $content .= "BROWSER: ". $HTTP_USER_AGENT."\n";
      }
      }

      mail_it(stripslashes($content), ($subject)?stripslashes($subject):"Анкета", $email, $recipient);
      if (file_exists($ar_file)) {
      $fd = fopen($ar_file, "rb");
      $ar_message = fread($fd, filesize($ar_file));
      fclose($fd);
      mail_it($ar_message, ($ar_subject)?stripslashes($ar_subject):"RE: Анкета", ($ar_from)?$ar_from:$recipient, $email);
      }

      if ($redirect) {
      header("Location: $redirect");
      exit;
      } else {
      echo "Анкета отправлена.\n";
      echo "<br><br>\n";
      echo "<small></small>\n\n";
      exit;
      }

      // <---------- THE END ----------> //

      Ребята если кто может и рабирается впишите в PHP куда надо нужный код.
      Не буду говорить, что очень это надо аж горит, просто помогите пожалуйста.
      Заранее спасибо.
        ого!

        Добавлено
        ладно, буду максимально демократичен.
        0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
        0 пользователей:


        Рейтинг@Mail.ru
        [ Script execution time: 0,0207 ]   [ 15 queries used ]   [ Generated: 26.04.24, 04:07 GMT ]