//inc.php を取り込む
include_once("./inc/inc.php");
//初期化
$err = "";
$errmsg = "";
$ok="";
//送信ボタン押し後
if($_REQUEST["submit"]){
$name = $_REQUEST["name"];
$mail_address = $_REQUEST["mail_address"];
$tel = $_REQUEST["tel"];
$comment = $_REQUEST["comment"];
//入力チェック
$ary = array(array("empty"),
array("NGchar"),
array("maxZen", 20));
$chk = new CheckError($name, "お名前", $ary);
if (strlen($chk->checkErrorAll())) {
$err = 1;
$errmsg = $errmsg . $chk->checkErrorAll();
}
$ary = array(array("empty"),
array("email"),
array("NGchar"),
array("max", 50));
$chk = new CheckError($mail_address, "メールアドレス", $ary);
if (strlen($chk->checkErrorAll())) {
$err = 1;
$errmsg = $errmsg . $chk->checkErrorAll();
}
$ary = array(array("empty"),
array("num"),
array("NGchar"));
$chk = new CheckError($tel, "電話番号", $ary);
if (strlen($chk->checkErrorAll())) {
$err = 1;
$errmsg = $errmsg . $chk->checkErrorAll();
}
$ary = array(array("empty"),
array("NGchar"),
array("maxZen", 1000));
$chk = new CheckError($comment, "お問合せ内容", $ary);
if (strlen($chk->checkErrorAll())) {
$err = 1;
$errmsg = $errmsg . $chk->checkErrorAll();
}
$captcha;
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
echo '
please check
';
echo "Go Back";
exit;
}
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LcNyPoUAAAAACMMgk_bvTjUAeGwvjq0ws96GIb2&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
//すべての入力項目に誤りが無ければ送信
if($err==""){
//メール送信<サンキュー>
$subject = "Ruca お問合せ完了";
$content = $name . "様"."\r\n\r\n";
$content .= "お問合せありがとうございました。\r\n";
$content .= "下記の内容でお問合せを受け付けました。\r\n";
$content .= "\r\n";
$content .= "お名前 :".$name." 様\r\n";
$content .= "E-mail :".$mail_address."\r\n";
$content .= "電話番号:".$tel."\r\n";
$content .= "【お問合せ内容】\r\n";
$content .= $comment."\r\n";
$content .= "\r\n";
$content .= "数日以内に担当者よりご連絡差し上げますので今しばらくお待ちください。\r\n";
$content .= "\r\n";
$content .= "―――――――――――――――――――――――――\r\n";
$content .= "Ruca\r\n";
$content .= "MAIL :".SET_SITE_MAIL."\r\n";
$content .= "URL :".SET_SITE_URL."\r\n";
$content .= "―――――――――――――――――――――――――\r\n";
send_mail($mail_address, $subject, $content, SET_SITE_MAIL, SET_SITE_NAME_S);
//メール送信<管理者向け>
$subject = "■お問合せ■RucaHP";
$content = "RucaHPよりお問合せがありました。\r\n";
$content .= "\r\n";
//$content .= "ご対応をお願いいたします。\r\n";
//$content .= "---------------------------------------\r\n";
$content .= "お名前 :".$name." 様\r\n";
$content .= "E-mail :".$mail_address."\r\n";
$content .= "電話番号:".$tel."\r\n";
$content .= "【お問合せ内容】\r\n";
$content .= $comment."\r\n";
//$content .= "---------------------------------------\r\n";
//$content .= SET_SITE_TITLE."\r\n";
//$content .= SET_SITE_URL;
send_mail(SET_SITE_MAIL, $subject, $content, $mail_address, $name);
send_mail(SET_SITE_MAIL2, $subject, $content, $mail_address, $name);
//完了フラグ立てる
$ok = 1;
}
}
?>
Ruca|お問合せフォーム
CONTACT
if($ok==1){//送信完了
?>