From 4a57f044a68e0a1c2d9b0c58297a5f61d3f40d2f Mon Sep 17 00:00:00 2001 From: alyx Date: Sat, 25 May 2024 14:59:42 -0400 Subject: fix captcha --- visitors.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'visitors.php') 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'); -- cgit v1.2.3-54-g00ecf