<head> <script language="JavaScript"> function checkID(id){ if(id.length != 13) return false; for(i=0, sum=0; i < 12; i++) sum += parseFloat(id.charAt(i))*(13-i); if((11-sum%11)%10!=parseFloat(id.charAt(12))) return false; return true;} var HttPRequest = false; function doCallAjax() { if(document.formRegister.username.value.length < 13){ alert('กรุณากรอก เลขบัตรประชาชน ให้ครบ 13 หลัก'); document.formRegister.username.focus(); return false; } if(document.formRegister.username.value.length > 13){ alert('ท่านกรอก เลขบัตรประชาชน เกิน 13 หลัก'); document.formRegister.username.focus(); return false; } if(!checkID(document.formRegister.username.value)){ alert('เลขบัตรประชาชนไม่ถูกต้อง'); document.formRegister.username.focus(); return false; } HttPRequest = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... HttPRequest = new XMLHttpRequest(); if (HttPRequest.overrideMimeType) { HttPRequest.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { HttPRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { HttPRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!HttPRequest) { alert('Cannot create XMLHTTP instance'); return false; } var url = 'card.php'; var pmeters = "tUsername=" + encodeURI( document.getElementById("username").value); HttPRequest.open('POST',url,true); HttPRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); HttPRequest.setRequestHeader("Content-length", pmeters.length); HttPRequest.setRequestHeader("Connection", "close"); HttPRequest.send(pmeters); HttPRequest.onreadystatechange = function() { if(HttPRequest.readyState == 3) // Loading Request { document.getElementById("mySpan").innerHTML = ".."; } if(HttPRequest.readyState == 4) // Return Request { if(HttPRequest.responseText == 'Y') { window.location = 'form.php'; } else { document.getElementById("mySpan").innerHTML = HttPRequest.responseText; } } } } </script> </head> <body> <tr> <td height=4 colspan="2" class="style10"> <div align="right">username : </div></td><td height=4 colspan="2" class="style10"><div align="left"> <span class="style15"> <input name='username' type='text' id='username' style='background-color:#ffFFFF; color:#0000FF;width:180px' size='30' maxlength="80" onChange="JavaScript:doCallAjax();"> </span></div></td> <td height=4 class="style15"><div align="left"><span id="mySpan" class="style19">กรุณาใช้เลขบัตรประจำตัวประชาชนเท่านั้น</span></div></td> </tr> </body>
<? header("content-type: text/xml; charset=windows-874"); $strUsername = trim($_POST["tUsername"]); if(trim($strUsername) == "") { echo "<img src='img/false.png'>"; exit(); } include "config.php"; $objDB = mysql_select_db($dbname); //*** Check Username (already exists) ***// $strSQL = "SELECT * FROM tb_ของคุณ WHERE username = '".$strUsername."' "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $objResult = mysql_fetch_array($objQuery); if($objResult) { echo "<img src='img/false.png'> เลขบัตรประชาชนนี้ ได้ทำการลงทะเบียนแล้ว"; } else { echo "<img src='img/true.png'> เลขบัตรประชาชนนี้ สามารถลงทะเบียนได้"; } mysql_close(); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง