| Server IP : 172.67.187.206 / Your IP : 172.71.28.155 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/news/datacenter/admin/template-pages/ |
Upload File : |
<?php
require_once "../config.php";
if(isset($_POST['cidcard']))
{
$cidcard=$_POST['cidcard'];
@ini_set('display_errors', '0');
function checkIdcard($id_card){
$id_card=str_split(str_replace('-','',$id_card));
$sum=0;
$digit=13;
foreach($id_card as $key){
$digit > 1 ? $sum += $digit * intval($key) : null;
$digit--;
}
$x = $sum % 11;
$n13 = $x <= 1 ? 1 - $x : 11 - $x;
if($n13 != $id_card[12]) {
return '<font color=red>หมายเลขบัตรประชาชนไม่ถูกต้อง</font>';
}else{
return '<font color=green>เลขบัตรประชาชนถูกต้อง</font>';
}
}
$chk_id = checkIdcard($cidcard);
$sql= $mysqli->query("SELECT * FROM read_data where cid='$cidcard' ");
//$total=mysqli_num_rows($sql);
if(mysqli_num_rows($sql)>0) {
echo "
<div class='alert alert-danger' role='alert'>
<div style='font-size:14px;'><strong><font color='red'><i class='fa fa-bell-o'></i> Error!</font></strong> พบข้อมูล $cidcard มีในระบบแล้ว. </div>
</div>
";
}else{ echo "
<div class='alert alert-danger' role='alert'>
<div style='font-size:14px;'><strong><font color='red'><i class='fa fa-bell-o'></i> แจ้งเตือนจากระบบ</font></strong> $chk_id</div>
</div>
"; }
}
?>