aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralyx <alyx@aleteoryx.me>2024-05-25 14:59:42 -0400
committeralyx <alyx@aleteoryx.me>2024-05-25 14:59:42 -0400
commit4a57f044a68e0a1c2d9b0c58297a5f61d3f40d2f (patch)
tree41bf6f9553cb314bad50488ac06b611443632a49
parent1df126f5265673296e8193377666e213c222ec0c (diff)
downloadvisitors_dot_php-4a57f044a68e0a1c2d9b0c58297a5f61d3f40d2f.tar.gz
visitors_dot_php-4a57f044a68e0a1c2d9b0c58297a5f61d3f40d2f.tar.bz2
visitors_dot_php-4a57f044a68e0a1c2d9b0c58297a5f61d3f40d2f.zip
fix captcha
-rw-r--r--visitors.php8
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');