= 5){ //失敗 fclose($fp); exit; } usleep(200); } } else { $fp = fopen($fname, "w"); //排他ロック $cnt = 0; while (flock($fp, LOCK_EX) === false){ if ($cnt++ >= 5){ //失敗 fclose($fp); exit; } usleep(200); } //ヘッダー出力 $line = ""; foreach ($FORM_LIST as $form) { //ラベルは出力なし if ($form->name === false) continue; $line .= '"' . $form->longname . '",'; } $line = $line . "\"送信日時\"\r\n"; fputs($fp, $line); } //出力 $line = ""; foreach ($FORM_LIST as $form) { //ラベルは出力なし if ($form->name === false) continue; if (!isset($_REQUEST[$form->name])) { $line .= '"",'; continue; } if ($form->type == FORM_TYPE_ARRAY) { $temp = ""; for ($i=0;$iname]);$i++) { $temp .= $_REQUEST[$form->name][$i]; if ($i < count($_REQUEST[$form->name])-1) $temp .= ','; } $line .= '"' . $temp . '",'; } else { $line .= '"' . $_REQUEST[$form->name] . '",'; } } $line = $line . '"' . $send_date . "\"\r\n"; fputs($fp, $line); //ロック解除 flock($fp, LOCK_UN); } //メール送信処理 $mail_body = ""; foreach ($FORM_LIST as $form) { //ラベル if ($form->name === false) { $mail_body .= $form->longname . "\r\n"; continue; } if (!isset($_REQUEST[$form->name])) { $mail_body .= $form->longname . ':r\n'; continue; } if ($form->type == FORM_TYPE_ARRAY) { $temp = ""; for ($i=0;$iname]);$i++) { $temp .= $_REQUEST[$form->name][$i]; if ($i < count($_REQUEST[$form->name])-1) $temp .= ','; } $mail_body .= $form->longname . ':' . $temp . "\r\n"; } else { $mail_body .= $form->longname . ':' . $_REQUEST[$form->name] . "\r\n"; } } //2008.8.3 追加 バックスラッシュ除去 $mail_body = stripslashes($mail_body); //文字コード変換 mb_language("ja"); mb_internal_encoding("UTF-8"); //$mail_subject = mb_encode_mimeheader($mail_subject); //$from_name = mb_encode_mimeheader($from_name); //$mail_subject = $mail_subject; //$from_name = $from_name; //管理者宛 if ($admin_mail_flg) { $header = "From:\"$admin_from_name\" <$admin_from_mailaddress>\r\n"; $temp_mail_body = $admin_mail_header . $mail_body . $admin_mail_footer; mb_send_mail($admin_mailaddress, $admin_mail_subject, $temp_mail_body, $header); } //送信者宛 if ($sender_mail_flg) { $header = "From:\"$sender_from_name\" <$sender_from_mailaddress>\r\n"; $temp_mail_body = $sender_mail_header . $mail_body . $sender_mail_footer; mb_send_mail($sender_mailaddress, $sender_mail_subject, $temp_mail_body, $header); } } //エラー情報 $err = false; //条件分岐 if (isset($_REQUEST['area']) && $_REQUEST['area'] == "その他") { chg_req_flg('area_others', true); } if (isset($_REQUEST['survey_2']) && $_REQUEST['survey_2'] == "その他") { chg_req_flg('survey_2others', true); } if (isset($_REQUEST['survey_7']) && $_REQUEST['survey_7'] == "今回登録する") { chg_req_flg('enews_format', true); } if (isset($_REQUEST['is_fbmember']) && $_REQUEST['is_fbmember'] == "はい") { chg_req_flg('idfb', true); } //値チェック $pre_value = checkValue($FORM_LIST); //フォーム画面(初期) if (!isset($_REQUEST['form_name'])) { require_once(DEF_PAGE_FORM); } else if (!$err) { //確認画面 if (!isset($_REQUEST['cfm'])) { require_once(DEF_PAGE_CONFIRM); //完了画面 } else { require_once(DEF_PAGE_COMPLETE); } //フォーム画面(エラー) } else { require_once(DEF_PAGE_FORM); } ?>