getting database configuration into an external file
This commit is contained in:
15
class.php
15
class.php
@@ -2,14 +2,19 @@
|
||||
|
||||
class ps4 {
|
||||
|
||||
public function dbconf() {
|
||||
global $dbconf;
|
||||
$dbconf = require "dbconf.php";
|
||||
return $dbconf;
|
||||
|
||||
}
|
||||
|
||||
function mysql_conn($sql=null) {
|
||||
$servername = "10.99.0.1";
|
||||
$username = "ps4";
|
||||
$password = "zpmAeh9cXM7xyFR";
|
||||
$dbname = "ps4";
|
||||
|
||||
$db = $this->dbconf();
|
||||
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
$conn = new mysqli($db["servername"], $db["username"], $db["password"], $db["dbname"]);
|
||||
$conn->set_charset("utf8");
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
|
||||
Reference in New Issue
Block a user