웹기술 2020. 5. 26. 08:48


반응형
구글 자동 등록 방지 기능 

Captcha


<fieldset id="fieldset_echapcha" class="row expanded small-collapse medium-uncollapse">
	<div class="small-12 medium-3 large-2 columns">
		<label class="text-left medium-text-right medium-middle"><strong class="key-point">등록방지</strong></label>
	</div>
	<div class="small-12 medium-9 large-10 columns">
		<div class="input-group auto-marbtm-5">
			<div id="captcha_container"></div>
			<input type="hidden" name="ecaptcha" id="ecaptcha" title="구글캡차">
		</div>
	</div>
</fieldset>

	<div class="row expanded auto-martop-10">
		<div class="small-12 medium-9 large-10 medium-offset-3 large-offset-2 columns">
			<button type="submit" name="write" class="button user-bg"><i class="fa fa-check fa-fw"></i>&nbsp;확인</button>
		</div>
	</div>

<!-- 폼영역 //-->



<!-- 스크립트영역 -->
<script src="https://www.google.com/recaptcha/api.js?onload=loadCaptcha&render=explicit" async defer></script>
<script>

	
		var loadCaptcha = function() {
			grecaptcha.render('captcha_container', {
				'sitekey'	: '6LeY3jQUAAAAAKAkhp4b1aJsqjn7YstxDTGydo8U',
				'callback'	: function(response) {												
					$("#ecaptcha").val( response );
				}
			});
		};

		function chkgrecaptcha() {
			if (typeof(grecaptcha) != 'undefined') {
				if (grecaptcha.getResponse() == "") {
					alert("자동등록방지를 확인해 주세요.");
					return false;
				}
			}
			
			return true;
		}
        </script>
반응형

'웹기술' 카테고리의 다른 글

쿠버네티스란 무엇인가?  (0) 2020.07.30
posted by 파인진
: