T201704030953

This commit is contained in:
Leander
2017-04-03 09:53:08 +02:00
parent 89e7c0090b
commit 4d657eccf3
3 changed files with 9 additions and 4 deletions

View File

@@ -10,8 +10,8 @@
$data = '';
$error = 0;
$values = null;
$uid = $_GET['uid'];
$length = $_GET['length'];
$uid = isset($_GET['uid']) ? $_GET['uid'] : '';
$length = isset($_GET['length']) ? $_GET['length'] : '';
$length = (($length === '0') || ($length && gettype(+$length) == 'integer')) ? +$_GET['length'] : 10;
$db = new Database();
$questions_count = $db->query('SELECT COUNT(*) FROM "Questions"')['data'][0]['count'];
@@ -23,7 +23,9 @@
return array_slice($numbers, 0, $count-1);
}
if($length == 0) {
if($uid = '') {
$error = 12103;
} else if($length == 0) {
$error = 12101;
} else if($length > $questions_count) {
$error = 12102;