<?php // modules/member/checkidcard.php header("content-type: text/html; charset=UTF-8"); // inint include '../../bin/inint.php'; // referer if (gcms::isReferer()) { $id = gcms::getVars($_POST, 'id', 0); $value = $db->sql_trim_str($_POST, 'value'); // phone if ($config['member_idcard'] == 1 && $value == '') { echo 'IDCARD_EMPTY'; } elseif ($value != '') { if (!gcms::checkIDCard($value)) { echo 'IDCARD_INVALID'; } else { // ตรวจสอบ phone $sql = "SELECT `id` FROM `" . DB_USER . "` WHERE `idcard`='{$value}' LIMIT 1"; $search = $db->customQuery($sql); if (sizeof($search) == 1 && ($id == 0 || $id != $search[0]['id'])) { echo 'IDCARD_EXISTS'; } } } }
$search = $db->customQuery($sql); if (sizeof($search) == 1) { $ret['ret_register_phone'] = 'PHONE_EXISTS'; $input = !$input ? 'register_phone' : $input; $error = !$error ? 'PHONE_EXISTS' : $error; } else { $ret['ret_register_phone'] = ''; } } elseif ($config['member_phone'] == 2) { $ret['ret_register_phone'] = 'PHONE_EMPTY'; $input = !$input ? 'register_phone' : $input; $error = !$error ? 'PHONE_EMPTY' : $error; } // idcard if ($save['idcard'] != '') { if (!gcms::checkIDCard($save['idcard'])) { $ret['ret_register_idcard'] = 'IDCARD_INVALID'; $input = !$input ? 'register_idcard' : $input; $error = !$error ? 'IDCARD_INVALID' : $error; } else { // ตรวจสอบ idcard ซ้ำ $sql = "SELECT `id` FROM `" . DB_USER . "` WHERE `idcard`='{$save['idcard']}' LIMIT 1"; $search = $db->customQuery($sql); if (sizeof($search) == 1) { $ret['ret_register_idcard'] = 'IDCARD_EXISTS'; $input = !$input ? 'register_idcard' : $input; $error = !$error ? 'IDCARD_EXISTS' : $error; } else { $ret['ret_register_idcard'] = ''; } }