diff --git a/app/Controllers/ContactController.php b/app/Controllers/ContactController.php index 4ac09ed..2844d8e 100644 --- a/app/Controllers/ContactController.php +++ b/app/Controllers/ContactController.php @@ -1,7 +1,7 @@ getConnection(); + + $contact = new ContactModel($pdo); $result = $contact->save([ 'first_name' => $firstName, 'last_name' => $lastName, @@ -77,7 +81,7 @@ class ContactController ]); if (!$result) { - Logger::logError("Failed to save contact form submission for email: $email"); + Logger::error("Failed to save contact form submission for email: $email"); Response::serverError('An error occurred while submitting your message. Please try again later.'); } @@ -86,7 +90,7 @@ class ContactController 'message' => 'Your message has been successfully submitted. Thank you!' ]); } catch (Exception $e) { - Logger::logError("Exception during contact form submission: " . $e->getMessage()); + Logger::error("Exception during contact form submission: " . $e->getMessage()); Response::serverError('A server error occurred. Please try again later.'); } } diff --git a/app/Utilities/Database.php b/app/Utilities/Database.php index 83a610d..cb656c1 100644 --- a/app/Utilities/Database.php +++ b/app/Utilities/Database.php @@ -37,7 +37,7 @@ class Database $dsn = sprintf('mysql:host=%s;dbname=%s;charset=utf8mb4', $_ENV['DB_HOST'], $_ENV['DB_NAME']); try { - $this->connection = new PDO($dsn, $_ENV['DB_USER'], $_ENV['DB_PASSWORD']); + $this->connection = new PDO($dsn, $_ENV['DB_USER'], $_ENV['DB_PASS']); $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); Logger::info('Database connection established successfully.'); } catch (PDOException $e) {