| Server IP : 148.113.13.24 / Your IP : 216.73.217.94 Web Server : Apache/2.4.59 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2 System : Linux o1.zxs.ovh 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64 User : b051826 ( 1041) PHP Version : 8.2.19 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/b051826/web/zenpathjapan.com/public_html/wp-content/themes/zenpathjapan/ |
Upload File : |
<?php
/**
* page-contact.php — contact form with anti-spam.
* Honeypot (website_url) + time-based check (< 3 sec = reject).
* Recipient is always SITE_EMAIL (domain-matching).
* Content holds intro + [zpj_contact_info] (company-info block) above the form.
*/
defined('ABSPATH') || exit;
$zpj_sent = false;
$zpj_err = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['zpj_contact'])) {
// honeypot — bots fill hidden fields
if (!empty($_POST['website_url'])) { $zpj_sent = true; goto zpj_render; }
// time-based — humans take longer than 3 sec
$ts = (int) ($_POST['_form_ts'] ?? 0);
if ($ts < 1 || (time() - $ts) < 3) { $zpj_sent = true; goto zpj_render; }
// nonce
if (!isset($_POST['zpj_nonce']) || !wp_verify_nonce($_POST['zpj_nonce'], 'zpj_contact')) {
$zpj_err = '送信を確認できませんでした。お手数ですが再度お試しください。';
goto zpj_render;
}
$name = sanitize_text_field($_POST['c_name'] ?? '');
$mail = sanitize_email($_POST['c_email'] ?? '');
$body = sanitize_textarea_field($_POST['c_msg'] ?? '');
if (!$name || !is_email($mail) || mb_strlen($body) < 5) {
$zpj_err = 'お名前・有効なメールアドレス・お問い合わせ内容(5文字以上)をご確認ください。';
goto zpj_render;
}
$subject = '[' . get_bloginfo('name') . '] お問い合わせ: ' . mb_substr($name, 0, 40);
$message = "お名前: {$name}\nメール: {$mail}\n\n{$body}\n";
$headers = ['Reply-To: ' . $name . ' <' . $mail . '>'];
wp_mail(SITE_EMAIL, $subject, $message, $headers);
$zpj_sent = true;
}
zpj_render:
get_header();
while (have_posts()) : the_post(); ?>
<article class="zpj-page zpj-contact">
<?php if (has_post_thumbnail()) : ?>
<div class="zpj-page-banner zpj-zone" style="min-height:34vh">
<?php the_post_thumbnail('zpj-wide', ['class' => 'zpj-zone__img', 'loading' => 'eager', 'fetchpriority' => 'high']); ?>
<div class="zpj-zone__cap"><span class="zpj-zone__kicker">CONTACT</span><span class="zpj-zone__title"><?php the_title(); ?></span></div>
</div>
<?php endif; ?>
<div class="zpj-wrap" style="max-width:760px">
<?php zpj_breadcrumbs(); ?>
<?php /* intro prose + [zpj_contact_info] company-info block live in the content */ ?>
<div class="zpj-content"><?php the_content(); ?></div>
<?php if ($zpj_sent) : ?>
<div class="zpj-form-ok">✓ お問い合わせを受け付けました。3営業日以内にご返信いたします。</div>
<?php else : ?>
<?php if ($zpj_err) : ?><div class="zpj-form-err"><?php echo esc_html($zpj_err); ?></div><?php endif; ?>
<form class="zpj-contact-form" method="post" action="<?php echo esc_url(get_permalink()); ?>">
<input type="hidden" name="zpj_contact" value="1">
<input type="hidden" name="_form_ts" value="<?php echo esc_attr(time()); ?>">
<?php wp_nonce_field('zpj_contact', 'zpj_nonce'); ?>
<!-- honeypot: must stay empty -->
<input type="text" name="website_url" autocomplete="off" tabindex="-1" aria-hidden="true" style="position:absolute;left:-9999px">
<label class="zpj-field"><span>お名前 <em>*</em></span>
<input class="zpj-input" type="text" name="c_name" required value="<?php echo isset($_POST['c_name']) ? esc_attr($_POST['c_name']) : ''; ?>"></label>
<label class="zpj-field"><span>メールアドレス <em>*</em></span>
<input class="zpj-input" type="email" name="c_email" required value="<?php echo isset($_POST['c_email']) ? esc_attr($_POST['c_email']) : ''; ?>"></label>
<label class="zpj-field"><span>お問い合わせ内容 <em>*</em></span>
<textarea class="zpj-input" name="c_msg" rows="6" required><?php echo isset($_POST['c_msg']) ? esc_textarea($_POST['c_msg']) : ''; ?></textarea></label>
<p class="zpj-field-note">ご入力いただいた情報は、お問い合わせ対応の目的にのみ利用します。詳しくは<a href="<?php echo esc_url(home_url('/privacy-policy/')); ?>">プライバシーポリシー</a>をご確認ください。</p>
<button class="zpj-btn" type="submit">送信する</button>
</form>
<?php endif; ?>
</div>
</article>
<?php endwhile; get_footer();