Malformed amka params check

parent 7618e1e7
......@@ -110,11 +110,19 @@ class App
$amka = $args['amka'];
$surname = $args['surname'];
$bdate = '';
if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})[0-9]*/', $amka, $bdate_parts) === 1) {
if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})[0-9]{5}/', $amka, $bdate_parts) === 1) {
$bdate = "{$bdate_parts[3]}-{$bdate_parts[2]}-{$bdate_parts[1]}";
if (intval($bdate_parts[3]) > 40) {
$bdate = "19{$bdate}";
}
} else {
// malformed id input
return $res->withJson(['message' => 'Malformed AMKA'], 500);
}
if (preg_match('/^[[:alpha:]Α-ΩΆΈΉΊΌΎΏ\s]+$/', urldecode($surname)) !== 1) {
// malformed surname input
return $res->withJson(['message' => 'Malformed surname'], 500);
}
$data = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment