폼메일에 캡차코드 적용

This commit is contained in:
chicpro
2013-01-21 11:00:15 +09:00
parent 7189e7dcc3
commit 208fff513e
2 changed files with 22 additions and 26 deletions

View File

@ -1,11 +1,12 @@
<?
define('G4_CAPTCHA', 1);
include_once('./_common.php');
include_once("$g4['path']/lib/mailer.lib.php");
include_once("{$g4['path']}/lib/mailer.lib.php");
if (!$config[cf_email_use])
alert('환경설정에서 "메일발송 사용"에 체크하셔야 메일을 발송할 수 있습니다.'.PHP_EOL.PHP_EOL.'관리자에게 문의하시기 바랍니다.');
if (!$config['cf_email_use'])
alert('환경설정에서 "메일발송 사용"에 체크하셔야 메일을 발송할 수 있습니다.\\n\\n관리자에게 문의하시기 바랍니다.');
if (!$is_member && $config[cf_formmail_is_member])
if (!$is_member && $config['cf_formmail_is_member'])
alert_close('회원만 이용하실 수 있습니다.');
$to = base64_decode($to);
@ -14,33 +15,31 @@ if (substr_count($to, "@") > 1)
alert_close('한번에 한사람에게만 메일을 발송할 수 있습니다.');
$key = get_session('captcha_keystring');
if (!($key && $key == $_POST[wr_key])) {
session_unregister('captcha_keystring');
alert('정상적인 접근이 아닌것 같습니다.');
if ($is_guest && !chk_captcha()) {
alert('스팸방지에 입력한 숫자가 틀렸습니다.');
}
for ($i=1; $i<=$attach; $i++)
for ($i=1; $i<=$attach; $i++)
{
if ($_FILES['file'.$i][name])
$file[] = attach_file($_FILES['file'.$i][name], $_FILES['file'.$i][tmp_name]);
if ($_FILES['file'.$i]['name'])
$file[] = attach_file($_FILES['file'.$i]['name'], $_FILES['file'.$i]['tmp_name']);
}
$content = stripslashes($content);
if ($type == 2)
if ($type == 2)
{
$type = 1;
$content = preg_replace("/\n/", "<br>", $content);
}
}
// html 이면
if ($type)
if ($type)
{
$current_url = $g4[url];
$mail_content = '<!doctype html><html lang="ko"><head><meta charset="'.$g4[charset].'"><title>메일보내기</title><link rel="stylesheet" href="'.$current_url.'/style.css"></head><body>'.$content.'</body></html>';
}
else
$current_url = $g4['url'];
$mail_content = '<!doctype html><html lang="ko"><head><meta charset="'.$g4['charset'].'"><title>메일보내기</title><link rel="stylesheet" href="'.$current_url.'/style.css"></head><body>'.$content.'</body></html>';
}
else
$mail_content = $content;
mailer($fnick, $fmail, $to, $subject, $mail_content, $type, $file);

View File

@ -1,17 +1,17 @@
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<div id="formmail" class="new_win">
<h1><?=$name?>님께 메일보내기</h1>
<form name="fformmail" method="post" onsubmit="return fformmail_submit(this);" enctype="multipart/form-data" style="margin:0px;">
<form name="fformmail" method="post" action="./formmail_send.php" onsubmit="return fformmail_submit(this);" enctype="multipart/form-data" style="margin:0px;">
<input type="hidden" name="to" value="<?=$email?>">
<input type="hidden" name="attach" value="2">
<input type="hidden" name="token" value="<?=$token?>">
<? if ($is_member) { // 회원이면 ?>
<input type="hidden" name="fnick" value="<?=$member[mb_nick]?>">
<input type="hidden" name="fmail" value="<?=$member[mb_email]?>">
<input type="hidden" name="fnick" value="<?=$member['mb_nick']?>">
<input type="hidden" name="fmail" value="<?=$member['mb_email']?>">
<? } ?>
<table class="frm_tbl">
<caption>메일쓰기</caption>
@ -77,9 +77,7 @@ with (document.fformmail) {
function fformmail_submit(f)
{
if (!check_kcaptcha(f.wr_key)) {
return false;
}
<? echo chk_captcha_js(); ?>
if (f.file1.value || f.file2.value) {
// 4.00.11
@ -89,7 +87,6 @@ function fformmail_submit(f)
document.getElementById('btn_submit').disabled = true;
f.action = "./formmail_send.php";
return true;
}
</script>