mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-19 20:33:06 +05:30
(refactor): changed connection.php credentials into .env
This commit is contained in:
15
htdocs/core/connection.php
Normal file
15
htdocs/core/connection.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
//Collect Database info
|
||||
$hostname = $_ENV['DB_HOST'];
|
||||
$username = $_ENV['DB_USER'];
|
||||
$password = $_ENV['DB_PASS'];
|
||||
$database = $_ENV['DB_NAME'];
|
||||
|
||||
//Connect with Database
|
||||
$conn = new mysqli($hostname, $username, $password, $database);
|
||||
|
||||
if ($conn -> connect_error) {
|
||||
die("Database Connection Failed !" . $conn->connect_error);
|
||||
}
|
||||
echo "";
|
||||
?>
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
require '../../connection.php';
|
||||
$dotenv = Dotenv\Dotenv::createImmutable('../../');
|
||||
$dotenv->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);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
require '../../connection.php';
|
||||
require 'vendor/autoload.php';
|
||||
$dotenv = Dotenv\Dotenv::createImmutable('../../');
|
||||
$dotenv->load();
|
||||
|
||||
require 'connection.php';
|
||||
require 'query_functions.php';
|
||||
|
||||
function input_filter($conn, $data){
|
||||
|
||||
Reference in New Issue
Block a user