Jestem nowy na Forum oraz potrzebuje waszej pomocy bo nie moge sobie poradzic z Captcha.
Problem jest tylko jeden ale dla mnie trudny, wszystko dziala jak nalezy ale jak ktos przepisze niepoprawnie captche to i tak wiadomosc zostaje wyslana...
Nie moge sobie poradzic zeby to razem zgrac z php
mam nadzieje ze ktos bylby tak mily i pomoglby mi albo podpowiedzial jak ta linijke w php dostosowac aby to dzialalo..
czyli najlatwiej mowiac jak moge tutdaj dodac linijke ktora wywali blad ze captcha zostala zle przepisana
$json=array("status"=>1,"msg"=>"<p class='status_ok'>Your message has been sent correctly.<br>Within a few seconds you will receive a copy of the sent E-Mail.<br>Thank you very much for using the service from<br>blabla</p>"); } } else{ $json=array("status"=>0,"msg"=>"<p class='status_err'>A script error has occurred.<br>Don`t worry, it's okay :)<br>Please try to send the same message again.</p>"); } } else{ $json=array("status"=>0,"msg"=>"<p class='status_err'>Please complete the required<br>fields marked with an asterisk *<br>and try to send the message again.</p>"); } exit; ?>
Ponizej przesylam caly kod
ENkontaktmail.php
<?php if($fname && $email && $sname && $titel && $message && $CaptchaInput && $datenschutz){ $headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=utf-8\r\nContent-Transfer-Encoding: 8bit"; $message_body = ' <!DOCTYPE html> </html> '; $message_body1 = ' <!DOCTYPE html> </html> '; $json=array("status"=>1,"msg"=>"<p class='status_ok'>Your message has been sent correctly.<br>Within a few seconds you will receive a copy of the sent E-Mail.<br>Thank you very much for using the service from<br>blabla</p>"); } } else{ $json=array("status"=>0,"msg"=>"<p class='status_err'>A script error has occurred.<br>Don`t worry, it's okay :)<br>Please try to send the same message again.</p>"); } } else{ $json=array("status"=>0,"msg"=>"<p class='status_err'>Please complete the required<br>fields marked with an asterisk *<br>and try to send the message again.</p>"); } exit; ?>
contact.html
<div class="site-section bg-light text-black"> <div class="container"> <div class="row"> <div class="col-md-7 mb-5"> <form method="post" action="../../php/ENkontaktmail.php" id="contact_form" onsubmit="return checkform(this);" class="p-5 bg-white"> <div class="row form-group"> <div class="row form-group"> <div class="col-md-12"> <input type="hidden" id="txtCaptcha"> </div> </div> <div class="row text-center form-group"> <div class="col-md-12"> <input type="submit" value="Send" class="btn btn-black py-3 px-5"> </div> </div> </form> </div> </div> </div>
generator captcha .js
function ValidCaptcha(){ [b]var str1 = removeSpaces(document.getElementById('txtCaptcha').value); var str2 = removeSpaces(document.getElementById('CaptchaInput').value);[/b] if (str1 == str2){ return true; }else{ return false; } } function removeSpaces(string){ } var code = a + b + c + d + e; document.getElementById("txtCaptcha").value = code; document.getElementById("CaptchaDiv").innerHTML = code;
tak to wyglada
