Email senden mit eigenen capacha

Ich habe mal einen eigenen Capacha gebaut der einfach ist , aber für Bots eigentlich nicht zu umgehen.Testet es mal selber. Download-Archiv
Kommentar abgeben zu diesen Beitrag/Code ?
Dann hier klicken

Der hier verwendete Code

<?php $break = "<br/>"; $eol .= "\r\n"; $sol .= "\n"; if (isset($_POST['submitted'])) { $errors = array(); if (empty($_POST['name'])) { $errors[] = 'Please enter your name.'; } // if (!preg_match("/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/", $_POST['email'])) { // $errors[] = 'Please enter a valid email address.'; // } if (empty($_POST['msg'])) { $errors[] = 'Please enter a message.'; } if (empty($errors)) { $siteName = 'Testmail Bastis1012 lösungspage'; $senderName = $_POST['name']; $senderMail = $_POST['email']; $url = $_POST['url']; $headers .= 'Date: '.date("r").$eol; $headers .= 'Sender-IP: '.$_SERVER["REMOTE_ADDR"].$eol; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-type: text/html; charset=iso-8859-1\r\n"; $empfaenger = "peter1012@gmx.de"; $absender = $senderName; $betreff = "Fehler melden $siteName "; $antwortan = "basti1012@soforthilfe-forum.de"; $header .= "From: $absender\r\n"; $header .= "Reply-To: $antwortan\r\n"; $header .= "X-Mailer: PHP ". phpversion(); $msg .= '<font face=arial size=2>'; $msg .= '<strong>Absender:</strong> '.$senderName.$break; $msg .= 'Sender-IP: '.$_SERVER["REMOTE_ADDR"].$break; $msg .= 'Angegebene URL: '.$url.$break; $msg .= 'Date: '.date("r").$break; $msg .= '<strong>Message:</strong> '.$_POST['msg'].$break; $msg .= '</font>'; echo '<div style="padding: 10px;">Thank you!<br><br>Your message has been received. </div></p>'; // echo '<meta http-equiv="refresh" content="3;url=email-versenden-funktionstuchtig.php">'; mail( $empfaenger, $betreff, $msg, $header); echo "<p class='ok'>Mail wurde gesendet<br><br>"; echo "$msg"; } else { echo '<strong>Error!</strong><br/><br/> The following error(s) occured.<br/>'; foreach ($errors as $message) { echo " - $message<br/>\n"; } // echo 'Please go <a href="javascript:history.go(-1)">back</a> and try again.</p>'; } } else { ?> <head> <style> header { display: flex; width: 100%; height: 100px; background: #4972a5; color: white; text-align: center; border-radius: 0px 0 10px 10px; } header h1 { margin-left: 10%; } body, main { width: 100%; display: flex; flex-direction: column; flex-wrap: nowrap; justify-content: center; align-content: center; align-items: center; } form { position: absolute; width: 100%; top: 0; left: 0; } #alless { position: absolute; top: 10px; background: #123456; width: 400px; height: 600px; border: 2px solid green; display: none; } #wrapper { position: relative; top: 10px; left: 50px; z-index: 0; width: 300px; height: 300px; border: 2px solid black; } #unten { display: block; width: 50px; height: 50px; position: relative; z-index: -1; border: 5px solid red; top: 125px; left: 125px; } .eins { position: absolute; z-index: 1; top: 10px; left: 10px; width: 30px; height: 30px; border: 1px solid black; background: yellow; } #bu, #bu1 { position: relative; top: 20px; display: none; text-align: center; } #aus { width: 100%; display: flex; flex-direction: row; position: relative; z-index: 3; top: 40px; text-align: center; color: white; font-weight: 900; } #bu p, #bu1 p { margin: 0; text-align: center; color: white; font-weight: 900; } #aus span { margin-left: 25px; } #XX { position: relative; top: 0px; left: 0px; font-size: 20px; font-weight: 900; color: white; background: red; height: 25px; width: 21px; cursor: pointer; } #XX:hover { background: green; color: red; } #senden { position: relative; left: -2000px; } .cap { text-align: center; color: white; font-size: 22px; } .anleitung { color: white; text-align: center; } #cap, #res, #treffer { background: #4972a5; border-radius: 10px; height: 35px; color: white; font-size: 20px; width: 250px; padding: 5px; } #cap:hover, #res:hover, #treffer:hover { background: #66a6e6; box-shadow: -1px -1px 13px 7px #66a6e6; } label { width: 100%; height: 20px; text-align: center; font-size: 18px; } .required, #f2, #f3 { width: 100%; height: 25px; border-radius: 5px; font-size: 20px; margin-top: 10px; margin-left: 20px; } .required:hover, #f2:hover, #f3:hover { box-shadow: -1px -1px 13px 7px #66a6e6; } #buttons { display: flex; flex-direction: row; width: 550px; } #f3 { height: 150px; } input:focus::-webkit-input-placeholder, textarea:focus::-webkit-input-placeholder { color: black; text-align: left; } input:focus:-moz-placeholder, textarea:focus:-moz-placeholder { color: black; text-align: left; } </style> <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script> </head> <body> <form name="dwmailer" enctype="multipart/form-data" method="post"> <main> <header><h1>Fehler melden,anregungen,oder einfach nur meckern</h1> </header> <div class="error" style="display:none;"> <img src="https://www.dw-formmailer.de/images/error.png" alt="Error" style="height:24px; width:24px; float:left; margin: -5px 10px 0px 0px; "><p></p></div> <label>Ihr Name: <font color="red">*</font></label> <input class="required" value="" type="text" id="f0" name="name" placeholder="Hier Ihren Namen eintragen!"> <label>Ihre E-Mail: <font color="red">*</font></label> <input class="required email" data-mini="true" data-clear-btn="true" type="email" id="f1" name="mail" placeholder="Hier Ihre E-Mail-Adresse eintragen!"> <label>Webseite mit dem Fehler (URL):</label> <input type="text" id="f2" name="url" placeholder="Hier die URL der fehlerhaften Webseite eintragen!"> <label>Beschreibung des Fehlers (wichtig für die Korrektur):</label> <textarea name="msg" id="f3" value="" placeholder="Hier bitte den Fehler beschreiben! Was geht nicht? Ist eine URL defekt? Ist ein Inhalt illegal? Wir freuen uns über jeden Fehler, den wir abstellen können!"></textarea> <label>Zum Schutz vor Spamattacken muss das Rätsel vorm senden gelöst werden.<font color="red">*</font></label> <div id="buttons"><input id="cap" type="button" value="Rätsel lösen fürs Senden"><input id="res" type="reset" value="Zurücksetzen"></div> </main> <input id="submi" type="hidden" name="submitted" value="TRUE" /> <input id="senden" type="submit" value="Abschicken"> </form> <div id="alless"><div id="XX">X</div> <h1 class="cap">Capatcha</h1> <p class="anleitung">Bewegen Sie mit den Pfeiltasten den kleinen Kasten in den großen.</p> <div id="wrapper"> <div id="unten"></div> <div class="eins" id="wert1"></div> </div> <div id="bu1"> <p>Welche farbe hatte der kleine Kasten?</p> <input type="text" class="frage" id="frage" placeholder=""> </div> <div id="bu"> <input type="button" id="treffer" value="Nachricht Senden"> <p>Sie sind kein Roboter...weiter gehts</p> </div> <div id="aus"> <span id="xxx"> </span> <span id="yyy"</span> </div> </div> </div> <script> var a=true; var b=true; var c=true; $('#cap').click(function(){ ff0=$('#f0').val(); ff1=$('#f1').val(); ff3=$('#f3').val(); if(ff0 != ''){ a=false; na=ff0+' Name ist Ok :) ' $('head').append('<style type="text/css">#f0{color:green;text-align:center;font-weight:600;}</style>'); $('#f0').attr('value',na); }else{ $('head').append('<style type="text/css">#f0::-webkit-input-placeholder,#f0::-webkit-input-placeholder{color:red;text-align:center;font-weight:600;}</style>'); $('#f0').attr('placeholder','Bitte Namen eintragen').focus(); } if(ff1 != ''){ function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } function validate() { var email = $("#f1").val(); if (validateEmail(email)) { $('#f1').attr('placeholder',email+' is valid :)'); $('head').append('<style type="text/css">#f1{color:green;text-align:center;font-weight:600;}</style>'); } else { $('#f1').attr('placeholder',''+email+'is not valid :('); $('head').append('<style type="text/css">#f1{color:red;text-align:left;font-weight:600;}</style>'); } return false; } validate(); b=false; }else{ $('#f1').attr('placeholder','Bitte Ihre Email eintragen für Rückantwort').focus(); $('head').append('<style type="text/css">#f1::-webkit-input-placeholder,#f1::-webkit-input-placeholder{color:red;text-align:center;font-weight:600;}</style>'); } if(ff3 != ''){ c=false; te=ff3+' Text ist Ok :) ' $('head').append('<style type="text/css">#f3{color:green;text-align:center;font-weight:600;}</style>'); $('#f3').attr('value',te); } else{ $('#f3').attr('placeholder','Bitte was schreiben sonst hat die Email ja kein sinn').focus(); $('head').append('<style type="text/css">#f3::-webkit-input-placeholder,#f3::-webkit-input-placeholder{color:red;text-align:center;font-weight:900;}</style>'); } console.log(a+'-'+b+'-'+c) if(a == false && b ==false && c==false){ gogo() console.log('Capacha go'); } }) function gogo(){ $('#XX').click(function(){ $('#alless').css('display','none'); }) $('#alless').css('display','block'); $('body').keydown(function(event){ var p1 = document.getElementById('wert1'); wertx=p1.offsetLeft; werty=p1.offsetTop; if(wertx<=3){ wertx=3; } if(wertx>=267){ wertx=267; } if(werty<=3){ werty=3; } if(werty>=267){ werty=267; } switch (event.keyCode) { case 39: move_left=-5; $('#wert1').css('left',wertx-move_left+'px'); break; case 38: move_top=5 $('#wert1').css('top',werty-move_top+'px'); break; case 37: move_right=-5; $('#wert1').css('left',wertx+move_right+'px'); break; case 40: move_bottom=5; $('#wert1').css('top',werty+move_bottom+'px'); break; } var p = document.getElementById('wert1'); xx=p.offsetLeft; yy=p.offsetTop; if(xx < 127){ $('#xxx').css('color','white'); var xin=false; $('#xxx').html('X'+xx) }else if(xx > 145){ $('#xxx').css('color','white'); var xin=false; $('#xxx').html('X'+xx) }else{ $('#xxx').html('X-Achse erreict'); $('#xxx').css('color','green'); var xin=true; } if(yy < 127){ var yin=false; $('#yyy').css('color','white'); $('#yyy').html('Y'+yy) }else if(yy > 145){ $('#yyy').css('color','white'); var yin=false; $('#yyy').html('Y'+yy) }else{ $('#yyy').css('color','green'); $('#yyy').html('Y-Achse erreicht'); var yin=true; } if(yin==true && xin==true){ $('#frage').focus(); $('#unten,.eins').css('background','green'); $('#bu1').css('display','block'); $('#aus').css('display','none'); $('#bu').css('display','none'); $('body').keyup(function(event){ frag=$('#frage').val(); if(frag=='gelb' || frag=='yellow'){ $('#bu').css('display','block'); }else{ $('#bu').css('display','none'); } }); }else{ $('.eins').css('background','yellow'); $('#bu,#bu1').css('display','none'); $('#unten').css('background','#123456'); $('#aus').css('display','block'); } }); $('#treffer').click(function(){ $('#senden').click() // location.reload(); }) } </script> <?php } ?>