<?php if(isset($_POST['Submit'])) { if(empty($_SESSION['letters_code'] ) || strcasecmp($_SESSION['letters_code'], $_POST['letters_code']) != 0) { echo"<script language='JavaScript'>"; echo"alert('The captcha code does not match!');"; echo"</script>"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <head> <!--------------- เช็ค Error ช่องว่าง ------------------> <script type="text/javascript" src="js/error_submit.js"></script> </head> <body> <form id="form" name="form" method="post" action="sendmail.php" onSubmit="JavaScript:return submit_contact();"> <table border="0" cellspacing="10" style="padding-left:420px;"> <tr> <td><div class="form_font">Name</div></td> <td><input type="text" name="name" id="name" /></td> </tr> <tr> <td><div class="form_font">Telephone</div></td> <td><input type="text" name="tel" id="tel" /></td> </tr> <tr> <td><div class="form_font">E-mail</div></td> <td><input type="text" name="email" id="email" /></td> </tr> <tr> <td><div class="form_font">Province</div></td> <td><input type="text" name="address" id="address" /></td> </tr> <tr> <td><div class="form_font">Subject</div></td> <td><input type="text" name="subject" id="subject" /></td> </tr> <tr> <td><div class="form_font">Message</div></td> <td><textarea name="message" rows="5" id="message"></textarea></td> </tr> <tr> <td> </td> <td><img src="captcha/captcha_code_file.php?rand=<?php echo rand(); ?>" id='captchaimg' ><br> <label for='message'>Enter the code above here :</label><br> <input type="text" id="letters_code" name="letters_code" ><br> <small>Can't read the image? click <a href='javascript: refreshCaptcha();'>here</a> to refresh</small> </td> </tr> <tr> <td> </td> <td><input type="submit" name="button" id="button" value="Submit" /> <input type="reset" name="button2" id="button2" value="Clear" /></td> </tr> </table> </form> <script language='JavaScript' type='text/javascript'> function refreshCaptcha() { var img = document.images['captchaimg']; img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000; } </script> </body> </html>
function submit_contact() { if(document.form.name.value == "") { alert('กรุณากรอกชื่อ-นามสกุล'); document.form.name.focus(); return false; } if(document.form.tel.value == "") { alert('กรุณากรอกเบอร์โทรติดต่อ'); document.form.tel.focus(); return false; } var emailFilter=/^.+@.+\..{2,3}$/; var str=document.form.email.value; if (!(emailFilter.test(str))) { alert ("กรุณากรอก Email ให้ถูกต้อง"); return false; } if(document.form.address.value == "") { alert('กรุณากรอกจังหวัด'); document.form.address.focus(); return false; } if(document.form.subject.value == "") { alert('กรุณากรอกหัวข้อเรื่อง'); document.form.subject.focus(); return false; } if(document.form.message.value == "") { alert('กรุณากรอกข้อความ'); document.form.message.focus(); return false; } if(document.form.letters_code.value == "") { alert('กรุณากรอก code CAPTCHA'); document.form.letters_code.focus(); return false; } return true; document.form.submit(); }
<?php if(isset($_POST['Submit'])) { if(empty($_SESSION['letters_code'] ) || strcasecmp($_SESSION['letters_code'], $_POST['letters_code']) != 0) { echo"<script language='JavaScript'>"; echo"alert('The captcha code does not match!');"; echo"</script>"; } } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง