From 6eeba2f01a377d5b51ddfba26fb9e61b0d6ae39b Mon Sep 17 00:00:00 2001 From: Subhamoy Biswas Date: Mon, 11 Dec 2023 01:08:55 +0530 Subject: [PATCH] (refactor): changed connection.php credentials into .env --- .env.example | 2 +- htdocs/blog.php | 6 +++++- htdocs/contact.php | 6 +++++- connection.php => htdocs/core/connection.php | 10 +++++----- htdocs/core/handle_contact.php | 8 ++++---- htdocs/core/handle_search.php | 6 +++++- htdocs/home.php | 6 +++++- htdocs/projects.php | 6 +++++- 8 files changed, 35 insertions(+), 15 deletions(-) rename connection.php => htdocs/core/connection.php (59%) diff --git a/.env.example b/.env.example index 582a25b..33190c2 100644 --- a/.env.example +++ b/.env.example @@ -10,4 +10,4 @@ SMTP_HOST = "Your SMTP Sender Host Name Here" SMTP_USER = "Your SMTP Sender Username Here" SMTP_PASS = "Your SMTP Sender Password Here" SMTP_SENDTO = "Your Email Inbox Address to Receive Emails" -SMTP_PORT = 587 \ No newline at end of file +SMTP_PORT = 465 \ No newline at end of file diff --git a/htdocs/blog.php b/htdocs/blog.php index 9e95119..b5b0fdd 100644 --- a/htdocs/blog.php +++ b/htdocs/blog.php @@ -1,5 +1,9 @@ load(); + +require 'core/connection.php'; require 'core/host_config.php'; require 'core/query_functions.php'; ?> diff --git a/htdocs/contact.php b/htdocs/contact.php index 22c7fa2..cf2b03b 100644 --- a/htdocs/contact.php +++ b/htdocs/contact.php @@ -1,5 +1,9 @@ load(); + +require 'core/connection.php'; require 'core/host_config.php'; require 'core/query_functions.php'; ?> diff --git a/connection.php b/htdocs/core/connection.php similarity index 59% rename from connection.php rename to htdocs/core/connection.php index 269df7c..9a1ef11 100644 --- a/connection.php +++ b/htdocs/core/connection.php @@ -1,9 +1,9 @@ load(); + +require 'connection.php'; require 'query_functions.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; -$dotenv = Dotenv\Dotenv::createImmutable('../../'); -$dotenv->load(); - function form_input_filter($conn, $data){ $data = trim($data); $data = stripslashes($data); diff --git a/htdocs/core/handle_search.php b/htdocs/core/handle_search.php index 1383684..a3548a6 100644 --- a/htdocs/core/handle_search.php +++ b/htdocs/core/handle_search.php @@ -1,5 +1,9 @@ load(); + +require 'connection.php'; require 'query_functions.php'; function input_filter($conn, $data){ diff --git a/htdocs/home.php b/htdocs/home.php index 417c89e..0728462 100644 --- a/htdocs/home.php +++ b/htdocs/home.php @@ -1,5 +1,9 @@ load(); + +require 'core/connection.php'; require 'core/host_config.php'; require 'core/query_functions.php'; ?> diff --git a/htdocs/projects.php b/htdocs/projects.php index 5d535c2..a0b4682 100644 --- a/htdocs/projects.php +++ b/htdocs/projects.php @@ -1,5 +1,9 @@ load(); + +require 'core/connection.php'; require 'core/host_config.php'; require 'core/query_functions.php';