리스트페이지 ajax 글쓰기 질문드려요.
본문
리스트페이지에서 이미지 누르면 다른 게시판에 ajax 로 글 쓰기를 만들고 있습니다.
비회원도 글 작성할 수 있도록 처리중인데 계속 캡차에서 오류가 나고 있습니다..
https://sir.kr/g5_tip/13517 이 글 참고해서 만들고 있으며 아래는 내용 입니다.
<div class="contact_from" id="contact_from">
<div class="form" id="bo_w">
<form name="fwrite" id="fwrite" method="post" onsubmit="return fwrite_submit(this);">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>" id="uid">
<input type="hidden" name="w" value="<?php echo $w ?>" id="w">
<input type="hidden" name="bo_table" value="contact" id="bo_table">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>" id="wr_id">
<div id="formWr">
<!-- <div class="bo_w_ico write_div">
<label for="ca_name" class="lb_icon"><i class="fa fa-check"></i> <span class="sound_only"> 분류<strong>필수</strong></span></label>
<select name="ca_name" id="ca_name" required class="frm_input full_input required">
<option value="">분류를 선택하세요</option>
</select>
</div> -->
<div class="bo_w_ico write_div">
<label for="wr_2" class="lb_icon"><i class="fa fa-building-o"></i> <span
class="sound_only">회사명<strong>필수</strong></span></label>
<input type="text" name="wr_2" value="" id="wr_2" required class="frm_input full_input required"
placeholder="회사명">
</div>
<div class="bo_w_ico write_div">
<label for="wr_name" class="lb_icon"><i class="fa fa-tag"></i> <span
class="sound_only">이름<strong>필수</strong></span></label>
<input type="text" name="wr_name" value="" id="wr_name" required
class="frm_input full_input required" placeholder="이름">
</div>
<div class="formCol2wr">
<div class="bo_w_ico write_div">
<label for="wr_email" class="lb_icon"><i class="fa fa-envelope-o"></i> <span
class="sound_only">이메일</span></label>
<input type="text" name="wr_email" value="" <?php echo $password_required ?> id="wr_email"
class="<?php echo $password_required ?> frm_input full_input email " placeholder="이메일">
</div>
<div class="bo_w_ico write_div">
<label for="wr_1" class="lb_icon"><i class="fa fa-phone"></i> <span
class="sound_only">연락처</span></label>
<input type="text" name="wr_1" value="" id="wr_1" <?php echo $password_required ?>
class="<?php echo $password_required ?> frm_input full_input" size="50" placeholder="연락처">
</div>
</div>
<div class="bo_w_ico bo_w_tit write_div">
<label for="wr_subject" class="lb_icon"><i class="fa fa-file"></i> <span class="sound_only">
제목<strong>필수</strong></span></label>
<input type="text" name="wr_subject" value="" id="wr_subject" required
class="frm_input full_input required" size="50" maxlength="255" placeholder="제목">
</div>
<div class="write_div">
<label for="wr_content" class="sound_only">내용<strong>필수</strong></label>
<div class="wr_content">
<textarea id="wr_content" name="wr_content" class="" maxlength="65536" style="width:100%;height:300px" placeholder="내용을 입력해 주세요."></textarea>
</div>
</div>
<div class="write_div_privacy">
<label><input type="checkbox" name="wr_agree" id="wr_agree" required> 개인정보처리방침에 동의합니다.</label>
</div>
<?
$keystring = uniqid();
set_session("ss_captcha_count", 0);
set_session("ss_captcha_key", $keystring);
$captcha_key = $_POST['captcha_key'] = get_session('ss_captcha_key');
?>
<!-- <div class="write_div">
<?php echo $captcha_html; ?>
</div> -->
<div class="btn_confirm write_div">
<input type="submit" value="작성완료" id="btn_submit" accesskey="s" class="btn_submit btn">
</div>
</div>
</form>
</div>
</div>
<script>
function fwrite_submit(f) {
$.ajax({
url: g5_bbs_url+"/write_update.php",
type: "POST",
data: {
"ajax_write": 'y',
"token": fwrite.token.value,
"uid": fwrite.uid.value,
"w": fwrite.w.value,
"bo_table": fwrite.bo_table.value,
"wr_id": fwrite.wr_id.value,
"wr_subject": fwrite.wr_subject.value,
"wr_name": fwrite.wr_name.value,
"wr_content": fwrite.wr_content.value
},
dataType: "text",
error: function(xhr, status, error){
alert(error);
},
async: false,
cache: false,
success : function(data){
console.log(data);
if(data=='success'){
alert('등록되었습니다.');
}else{
alert('실패');
return false;
}
$("#fwrite")[0].reset();
}
});
}
</script>
캡차를 사용하든 안하든 계속 자동입력방지 코드가 틀리다고 나오네요..
감사합니다.
!-->답변 1
/bbs/write_update.php
에서 자동입력방지 코드를 삭제하세요.
if ($is_use_captcha && !chk_captcha()) {
alert('자동등록방지 숫자가 틀렸습니다.');
}
답변을 작성하시기 전에 로그인 해주세요.