まず知識が乏しく、質問の仕方が不味かったら申し訳ありません。
サイトのSSL化を行ったところ、それまで動いていたお問い合わせフォームが正常に動作しなくなりました。
もし修正すべき点がありましたらご教授いただければと思います。
SSL化前
http://www.hogehoge.co.jp/contact/ よりフォ-ムに記載し、確認ボタンを押すと http://www.hogehoge.co.jp/contact/index.php に入力内容の確認画面が表示されていました。
※こちらは現在も、SSL環境で無ければ動作致します。
SSL化後
SSL化後、https://www.hogehoge.co.jp/contact/ よりフォームに記載後、確認ボタンを押すと、https://www.hogehoge.co.jp/contact/index.php にアクセスはするのですが、入力内容の確認画面では無くcontact/と同一の内容が表示されます(フォームの内容はクリアされています)
こちら原因、又は修正する方法はありますでしょうか?
利用レンタルサーバー/プラン
大塚商会 アルファメール2
phpの内容
phpの内容を以下に掲載させていただきます。
index.php
1<?php 2 3//変数定義 4$contact_name = ''; 5$contact_kana = ''; 6$contact_comname = ''; 7$contact_comkana = ''; 8$contact_zip = ''; 9$contact_add = ''; 10$contact_mail = ''; 11$contact_tel = ''; 12$contact_cont = ''; 13 14///エラーMSG 15$error_contact_name = ''; 16$error_contact_kana = ''; 17$error_contact_mail = ''; 18$error_contact_tel = ''; 19$error_contact_cont = ''; 20 21$err_flg = 0; 22 23if (!isset($_POST['sousin'])) { 24 $_POST['sousin'] = ''; 25} 26if (!isset($_POST['modoru'])) { 27 $_POST['modoru'] = ''; 28} 29 30if ($_POST['sousin'] != '' || $_POST['modoru'] != '') { 31 32 include 'replacetext.php'; 33 $search = array("\""); 34 $replace = array("”"); 35 36 $contact_name = str_replace($search, $replace, $_POST['contact_name']); 37 $contact_kana = str_replace($search, $replace, $_POST['contact_kana']); 38 $contact_comname = str_replace($search, $replace, $_POST['contact_comname']); 39 $contact_comkana = str_replace($search, $replace, $_POST['contact_comkana']); 40 $contact_zip = str_replace($search, $replace, $_POST['contact_zip']); 41 $contact_add = str_replace($search, $replace, $_POST['contact_add']); 42 $contact_mail = str_replace($search, $replace, $_POST['contact_mail']); 43 $contact_tel = str_replace($search, $replace, $_POST['contact_tel']); 44 $contact_cont = str_replace($search, $replace, $_POST['contact_cont']); 45 46 $contact_name = replaceText($_POST['contact_name']); 47 $contact_kana = replaceText($_POST['contact_kana']); 48 $contact_comname = replaceText($_POST['contact_comname']); 49 $contact_comkana = replaceText($_POST['contact_comkana']); 50 $contact_zip = replaceText($_POST['contact_zip']); 51 $contact_add = replaceText($_POST['contact_add']); 52 $contact_mail = replaceText($_POST['contact_mail']); 53 $contact_tel = replaceText($_POST['contact_tel']); 54 $contact_cont = replaceText($_POST['contact_cont']); 55 56 $contact_name = htmlspecialchars($_POST['contact_name']); 57 $contact_kana = htmlspecialchars($_POST['contact_kana']); 58 $contact_comname = htmlspecialchars($_POST['contact_comname']); 59 $contact_comkana = htmlspecialchars($_POST['contact_comkana']); 60 $contact_zip = htmlspecialchars($_POST['contact_zip']); 61 $contact_add = htmlspecialchars($_POST['contact_add']); 62 $contact_mail = htmlspecialchars($_POST['contact_mail']); 63 $contact_tel = htmlspecialchars($_POST['contact_tel']); 64 $contact_cont = htmlspecialchars($_POST['contact_cont']); 65 66 $contact_name = mb_convert_kana($contact_name, 'KV', 'UTF-8'); 67 $contact_kana = mb_convert_kana($contact_kana, 'KV', 'UTF-8'); 68 $contact_comname = mb_convert_kana($contact_comname, 'KV', 'UTF-8'); 69 $contact_comkana = mb_convert_kana($contact_comkana, 'KV', 'UTF-8'); 70 $contact_zip = mb_convert_kana($contact_zip, 'KV', 'UTF-8'); 71 $contact_add = mb_convert_kana($contact_add, 'KV', 'UTF-8'); 72 $contact_mail = mb_convert_kana($contact_mail, 'KV', 'UTF-8'); 73 $contact_tel = mb_convert_kana($contact_tel, 'KV', 'UTF-8'); 74 $contact_cont = mb_convert_kana($contact_cont, 'KV', 'UTF-8'); 75 76 //エラーチェック 77 78 //氏名 79 if ($contact_name == '') { 80 $err_flg = 1; 81 $error_contact_name = 'お名前が入力されていません'; 82 } 83 84 //都道府県 85 if ($contact_kana == '') { 86 $err_flg = 1; 87 $error_contact_kana = 'お名前フリガナが入力されていません'; 88 } 89 90 //メール 91 if ($contact_mail == '') { 92 $err_flg = 1; 93 $error_contact_mail = 'メールアドレスが入力されていません'; 94 } else { 95 if (!preg_match('/^[-+\\w]+(\\.[-+\\w]+)*@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]{2,6}$/i', $contact_mail)) { 96 $err_flg = 1; 97 $error_contact_mail = 'メールアドレスが正しく入力されていません'; 98 } 99 } 100 101 //電話番号 102 if ($contact_tel == '') { 103 $err_flg = 1; 104 $error_contact_tel = '連絡先電話番号が入力されていません'; 105 } 106 107 //お問合せ内容 108 if ($contact_cont == '') { 109 $err_flg = 1; 110 $error_contact_cont = 'お問合せ内容が入力されていません'; 111 } 112 113 114 if ($err_flg == 0 && $_POST['modoru'] == '') { 115 include "confirm.php"; 116 exit; 117 } elseif ($err_flg != 0) { 118 $error_contact_mess = '入力エラーがあります。入力内容をご確認ください'; 119 } 120} 121 122?>
confirm.php
1<?php 2 3/* 不正アクセスチェック用 */ 4include 'check.php'; 5 6?>
check.php
1<?php 2 3//設置するサイトのアドレスを""の中に入力。http://は入れない。最後の'/'も入れない。 4$siteAddress = "hogehoge.co.jp"; 5 6$protname; 7 8//ssl判定 9if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') 10{ 11 $protname = 'https'; 12}else{ 13 $protname = 'http'; 14} 15 16//フォームのURL 17$sitename = $protname."://".$siteAddress."/contact/index.php"; 18$sitename2 = $protname."://".$siteAddress."/contact/"; 19 20 21if(isset($_SERVER['HTTP_REFERER'])){ 22if ( $_SERVER['HTTP_REFERER'] != $sitename && $_SERVER['HTTP_REFERER'] != $sitename2 ){ 23 header("Location: ".$sitename); 24 exit(); 25} 26} 27 28?>
mailto.php
1<?php 2 3//お問合わせ 4$mail_to_inq = 'info@hogehoge.co.jp'; 5 6 7?>
情報量が少なく恐縮ですが、修正すべき点がありましたら(きっとあるとは思いますが…)ご教授いただければと思います。
回答1件
あなたの回答
tips
プレビュー