diff options
| -rw-r--r-- | visitors.php | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/visitors.php b/visitors.php index cf7507c..0f012b9 100644 --- a/visitors.php +++ b/visitors.php @@ -472,8 +472,12 @@ $db = get_database_for_file($config['db']);  function builtin_captcha(): array {    global $db; -  return ['prompt' => 'What is the name of the most recent visitor?', -          'answer' => trim($db->list_rows()[0]['name'])]; +  $rows = $db->list_rows(); +  if (isset($rows[0]['name'])) +    return ['prompt' => 'What is the name of the most recent visitor?', +            'answer' => trim($rows[0]['name'])]; +  else return ['prompt' => 'What is the year?', +               'answer' => date('Y')];  }  header('Refresh: 1400'); | 
