QHXD1.00001 = QHXD100001 = QHXD.00001 = QHXD1 (= …) = D00001 = 00001 = 1
Thật bó tay với cái số báo danh 😥 Mà cũng tại thằng hâm quá cầu toàn :p
if ( preg_match("/^((QH[a-z])?(C|D[1-6]?)?\s?)?\d+$/i", $input) ) {
$uniQuery = $examgroupQuery = '';
// Get the last 5 numbers
// because we'll never have more than 99999 candidates :p
$ordernum = preg_replace("/\D/", '', $input);
if (strlen($ordernum) < 5) {
$times = 5 - strlen($ordernum);
$ordernum = str_repeat("0", $times) . "$ordernum";
} else if (strlen($ordernum) > 5) {
$ordernum = substr($ordernum, -5);
}
// Get the university's code
$uni = preg_replace("/(^QH[a-z]).*/i", '$1', $input);
if ( preg_match("/^QH[a-z]$/i", $uni) )
$uniQuery = "AND uni1='$uni'";
// Get the examination group
$examgroup = preg_replace("/^(QH[a-z])?(C|D[1-6]?)\s?\d+$/i", '$2', $input);
$examgroup = preg_replace("/\d/", '', $examgroup); // D[1-6] are on the SAME sequence
if ( preg_match("/^(C|D[1-6]?)$/i", $examgroup) )
$examgroupQuery = "AND examgroup REGEXP '^$examgroup'";
// echo "WHERE ordernum='$ordernum' $uniQuery $examgroupQuery";
// Now make the query
if ( $cdds = $mDB->get_results("SELECT $columns
FROM candidates
WHERE ordernum='$ordernum' $uniQuery $examgroupQuery") ) {
$results = $cdds;
} else {
$message = "Nhập kiểu gì vậy ta???";
}
}
Chưa có điểm khối D để kiểm tra kĩ. ĐH Ngoại ngữ củ chuối!
