From 52f206cc386456d3c445f0593fdfb71ae92ba643 Mon Sep 17 00:00:00 2001 From: Lain Iwakura Date: Mon, 16 Jun 2025 02:15:32 +0300 Subject: [PATCH] fixin... --- main/login.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/main/login.php b/main/login.php index ac05bfb..094f781 100644 --- a/main/login.php +++ b/main/login.php @@ -9,13 +9,18 @@ header('Content-Security-Policy: default-src \'self\'; style-src \'self\' \'unsa header('Strict-Transport-Security: max-age=31536000; includeSubDomains'); session_start(); -$config = require 'config.php'; -$db = new PDO( - "mysql:host={$config['db']['host']};dbname={$config['db']['name']}", - $config['db']['user'], - $config['db']['pass'] -); -$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +try { + $config = require 'config.php'; + $db = new PDO( + "mysql:host={$config['db']['host']};dbname={$config['db']['name']}", + $config['db']['user'], + $config['db']['pass'] + ); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +} catch (PDOException $e) { + error_log("Database connection error: " . $e->getMessage()); + die("Database connection error"); +} $error = ''; $success = ''; @@ -51,6 +56,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $error = 'User not found'; } } catch (PDOException $e) { + error_log("Login error: " . $e->getMessage()); $error = 'Server error'; } }