폼메일에 자동입력방지 적용하기 문의드립니다.

폼메일에 자동입력방지 적용하기 문의드립니다.

QA

폼메일에 자동입력방지 적용하기 문의드립니다.

본문

아래 그림처럼 그누보드와 관계없는 폼메일 보내기를 head.php의 메뉴부분에 넣으려고 합니다.

파일을 만들때 그누보드의 head.php, common.php를 사용하지 않고 하드코딩했읍니다.

폰메일보내기 맨하단에 자동입력방지를 넣으려고 하는데 어떻게 하면 좋겠는지요? 그누보드 captha를 사용하려면 common.php등 파일을 인크루드해서 어떻게 해야할것 같은데 방법을 모르겠습니다.

고수님의 조언을 구합니다. 감사합니다.

 

* code.

<!DOCTYPE html>
<html>
<head>
  <title>Modal Formmail</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    
  <style>
  .modal-header, h4, .close {
      background-color: #5cb85c;
      color:white !important;
      text-align: center;
      font-size: 30px;
  }
  .modal-footer {
      background-color: #f9f9f9;
  }
  </style>
</head>
<body>

<div class="container">

    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
          
          <!--Modal header-->
        <div class="modal-header" style="padding:35px 50px;">
          <button type="button" class="close" data-dismiss="modal">×</button>
          <h4><span class="glyphicon glyphicon-lock"></span>Formmail Sending</h4>
        </div>
          
          <!--Modal body-->
        <div class="modal-body" style="padding:40px 50px;">
          <!--Form-->
          <form method="post" action="../../../templates/formmail/form_mail.php">
            <legend> 홈페이지 문의</legend>
              
              <!--usrname-->
            <div class="form-group">
              <label for="name"><span class="glyphicon glyphicon-user"></span> Name</label>
              <input type="text" class="form-control" id="name" name="name" placeholder="Enter Name">
            </div>          
              
              <!--phone-->
            <div class="form-group">
              <label for="phone"><span class="glyphicon glyphicon glyphicon-phone"></span>Phone </label>
              <input type="text" class="form-control" id="phone" name="phone" placeholder="*** 개인정보보호를 위한 휴대폰번호 노출방지 ***">
            </div>

            <!--email-->
            <div class="form-group">
              <label for="email"><span class="glyphicon glyphicon-envelope"></span>Email </label>
              <input type="email" class="form-control" id="email" name="email" placeholder="*** 개인정보보호를 위한 이메일주소 노출방지 ***">
            </div>
              
            <!--confer site-->
            <div class="form-group">
                <label for="confer"><span class="glyphicon glyphicon-leaf"></span>Confer Site </label>
              <input type="text" class="form-control" id="confer" name="confer" placeholder="www.test.com">
            </div>
              
            <!--domains-->
            <div class="form-group">
              <label for="domain"><span class="glyphicon glyphicon-globe"></span>Domail have? </label>
              <input type="text" class="form-control" id="domain" name="domain" placeholder="Yes I have">
            </div>
              
            <!--content-->
            <div class="form-group">
              <label for="content"><span class="glyphicon glyphicon-pencil"></span> </label>
              <textarea name="content" cols="65" rows="10"   style="border:#000 solid thin" >I need this type of Homepage.</textarea>
            </div>
              
             <!--button-->
              <button type="submit" class="btn btn-success btn-block"><span class=""></span> Send
              </button>
            </form>
          </div>

          <!--Modal footer-->
        <div class="modal-footer">
          <button type="submit" class="btn btn-danger btn-default pull-left" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> Cancel</button>
          <p>Not a member? <a href="#">Sign Up</a></p>
          <p>Forgot <a href="#">Password?</a></p>
        </div>
      </div>
      
    </div>
  </div> 

 
<script>
$(document).ready(function(){
    $("#myBtn").click(function(){
        $("#myModal").modal();
    });
});
</script>

</body>
</html>

이 질문에 댓글 쓰기 :

답변 2

내용 추가 로 검색해서 나오는 부분을 추가하였습니다.


<?php
//--------------------------------
//내용 추가 
include_once('./_common.php');
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
$captcha_html = captcha_html();
$captcha_js   = chk_captcha_js();
?>
<!DOCTYPE html>
<html>
<head>
  <title>Modal Formmail</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    
  <style>
  .modal-header, h4, .close {
      background-color: #5cb85c;
      color:white !important;
      text-align: center;
      font-size: 30px;
  }
  .modal-footer {
      background-color: #f9f9f9;
  }
  </style>
</head>
<body>
<div class="container">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
          
          <!--Modal header-->
        <div class="modal-header" style="padding:35px 50px;">
          <button type="button" class="close" data-dismiss="modal">×</button>
          <h4><span class="glyphicon glyphicon-lock"></span>Formmail Sending</h4>
        </div>
          
          <!--Modal body-->
        <div class="modal-body" style="padding:40px 50px;">
          <!--Form-->
      <!-- 내용 추가   -->
          <form method="post" action="../../../templates/formmail/form_mail.php" onsubmit="return fwrite_submit(this);">
            <legend> 홈페이지 문의</legend>
              
              <!--usrname-->
            <div class="form-group">
              <label for="name"><span class="glyphicon glyphicon-user"></span> Name</label>
              <input type="text" class="form-control" id="name" name="name" placeholder="Enter Name">
            </div>          
              
              <!--phone-->
            <div class="form-group">
              <label for="phone"><span class="glyphicon glyphicon glyphicon-phone"></span>Phone </label>
              <input type="text" class="form-control" id="phone" name="phone" placeholder="*** 개인정보보호를 위한 휴대폰번호 노출방지 ***">
            </div>
            <!--email-->
            <div class="form-group">
              <label for="email"><span class="glyphicon glyphicon-envelope"></span>Email </label>
              <input type="email" class="form-control" id="email" name="email" placeholder="*** 개인정보보호를 위한 이메일주소 노출방지 ***">
            </div>
              
            <!--confer site-->
            <div class="form-group">
                <label for="confer"><span class="glyphicon glyphicon-leaf"></span>Confer Site </label>
              <input type="text" class="form-control" id="confer" name="confer" placeholder="www.test.com">
            </div>
              
            <!--domains-->
            <div class="form-group">
              <label for="domain"><span class="glyphicon glyphicon-globe"></span>Domail have? </label>
              <input type="text" class="form-control" id="domain" name="domain" placeholder="Yes I have">
            </div>
              
            <!--content-->
            <div class="form-group">
              <label for="content"><span class="glyphicon glyphicon-pencil"></span> </label>
              <textarea name="content" cols="65" rows="10"   style="border:#000 solid thin" >I need this type of Homepage.</textarea>
            </div>
        <!-- 내용 추가 -->
        <div class="form-group">
              <label for="domain"><span class="glyphicon glyphicon-globe"></span>자동 등록방지 </label>
              <?php echo $captcha_html ?>
            </div>

             <!--button-->
              <button type="submit" class="btn btn-success btn-block"><span class=""></span> Send
              </button>
            </form>
          </div>
          <!--Modal footer-->
        <div class="modal-footer">
          <button type="submit" class="btn btn-danger btn-default pull-left" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> Cancel</button>
          <p>Not a member? <a href="#">Sign Up</a></p>
          <p>Forgot <a href="#">Password?</a></p>
        </div>
      </div>
      
    </div>
  </div> 
<!-- 내용 추가 -->
<script>
 function fwrite_submit(f)
{
    <?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함  ?>
    return true;
}
</script>

<script>
$(document).ready(function(){
    $("#myBtn").click(function(){
        $("#myModal").modal();
    });
});
</script>
</body>
</html>

 

 


//내용 추가
/*************************/
form_mail.php 에서 캡챠 검사
include_once('./_common.php');
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
if (!chk_captcha()) {
    alert('자동등록방지 숫자가 틀렸습니다.');
}

 

 

답변을 작성하시기 전에 로그인 해주세요.
전체 59,609
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT