isValid()) { $posts = $ContactValidator->getProperDatas(); $Smarty->assign('selects', $values); $Smarty->assign('posts', $posts); $Smarty->display('contact-complete.tpl'); /** * Send Mail */ // Client $mail_title = $config['mail']['clientTitle']; $mail_body = $Smarty->fetch('mail/base.tpl'); $header_define = $config['mail']['from']; $header = "From:{$header_define}\n"; mb_internal_encoding("UTF-8"); mb_send_mail($config['mail']['to'], $mail_title, $mail_body, $header, "-f".$header_define); // User $mail_title = $config['mail']['userTitle']; $mail_body = $Smarty->fetch('mail/confirm.tpl'); $header_define = $config['mail']['from']; $header = "From:{$header_define}\n"; mb_internal_encoding("UTF-8"); mb_send_mail($posts['mail'], $mail_title, $mail_body, $header, "-f".$header_define); // Reload countermeasure $_SESSION['isComplete'] = 1; exit(); } else { $posts = $ContactValidator->getProperDatas(); $Smarty->assign('selects', $values); $Smarty->assign('posts', $posts); $Smarty->assign('errors', $ContactValidator->getErrorMessages()); $Smarty->display('contact-confirm.tpl'); exit(); } } else { // Confirm $_SESSION['post'] = $_POST; if ($posts = $ContactValidator->isValid()) { $posts = $ContactValidator->getProperDatas(); $Smarty->assign('selects', $values); $Smarty->assign('posts', $posts); $Smarty->display('contact-confirm.tpl'); } else { $posts = $ContactValidator->getProperDatas(); $Smarty->assign('selects', $values); $Smarty->assign('posts', $posts); $Smarty->assign('errors', $ContactValidator->getErrorMessages()); $Smarty->display('contact.tpl'); exit(); } } } else { if ($_GET['back'] == 'on') { $Smarty->assign('posts', $_SESSION['post']); } $Smarty->assign('selects', $values); $Smarty->display('contact.tpl'); unset($_SESSION['isComplete']); exit(); } ?>