<?php
class Database
{
     
    private $host = "localhost";
    private $db_name = "stcuatop_db";
    private $username = "stcuatop_user";
    private $password = "mypasswordleaked";
    public $conn;
     
    public function dbConnection()
	{
     
	    $this->conn = null;
	    $DB_con = null;
        try
		{
            $this->conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name, $this->username, $this->password);
			$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);	
			
        }
		catch(PDOException $exception)
		{
            echo "Connection error: " . $exception->getMessage();
        }
         
        return $this->conn;
    }
}

$connection = mysqli_connect('localhost', 'stcuatop_user', 'mypasswordleaked');
if (!$connection){
    die("Database Connection Failed" . mysqli_error($connection));
}
$select_db = mysqli_select_db($connection, 'stcuatop_db');
if (!$select_db){
    die("Database Selection Failed" . mysqli_error($connection));
}



$DB_host = "localhost";
$DB_user = "stcuatop_user";
$DB_pass = "mypasswordleaked";
$DB_name = "stcuatop_db";


try
{
	$DB_con = new PDO("mysql:host={$DB_host};dbname={$DB_name}",$DB_user,$DB_pass);
	$DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
	echo $e->getMessage();
}