This commit is contained in:
aftercase 2021-07-15 19:16:49 +01:00
commit b2f4dc69d8
2 changed files with 2 additions and 7 deletions

View file

@ -63,7 +63,7 @@ function captcha($color, $mode, $mul, $allowed) {
}
// Overwrite defaults with custom config values
if (is_array($config)) {
if (!empty($config) && is_array($config)) {
foreach ($config as $key => $value)
$captcha_config[$key] = $value;
}
@ -82,8 +82,6 @@ function captcha($color, $mode, $mul, $allowed) {
if ($captcha_config['max_font_size'] < $captcha_config['min_font_size'])
$captcha_config['max_font_size'] = $captcha_config['min_font_size'];
// Use milliseconds instead of seconds
srand(microtime() * 100);
// Generate CAPTCHA code if not set by user
if (empty($captcha_config['code'])) {
@ -136,9 +134,6 @@ if (isset($_GET['_CAPTCHA'])) {
if (!$captcha_config)
exit();
// Use milliseconds instead of seconds
srand(microtime() * 100);
// Pick random background, get info, and start captcha
$background = $captcha_config['backgrounds'][rand(0, count($captcha_config['backgrounds']) - 1)];
list($bg_width, $bg_height, $bg_type, $bg_attr) = getimagesize($background);

View file

@ -142,7 +142,7 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
updatePageViews($conn);
// POST Handler
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$error = validatePasteFields();
if ($error !== null) {