moved ip address to environment variable.
This commit is contained in:
@@ -4,12 +4,20 @@ require_once 'vendor/autoload.php';
|
|||||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
||||||
$dotenv->safeLoad();
|
$dotenv->safeLoad();
|
||||||
$db_pass = $_ENV['DATABASE_PASSWORD'];
|
$db_pass = $_ENV['DATABASE_PASSWORD'];
|
||||||
|
$ip_addr = $_ENV['IP_ADDRESS'];
|
||||||
|
|
||||||
// Make some constants
|
// Make some constants
|
||||||
define('HOST', '173.255.248.228');
|
if ($_SERVER['HTTP_HOST'] == 'localhost') {
|
||||||
define('USER', 'root');
|
define('HOST', 'localhost');
|
||||||
define('PASS', $db_pass);
|
define('USER', 'root');
|
||||||
define('DB', 'palindromes');
|
define('PASS', $db_pass);
|
||||||
|
define('DB', 'palindromes');
|
||||||
|
} else {
|
||||||
|
define('HOST', $ip_addr);
|
||||||
|
define('USER', 'root');
|
||||||
|
define('PASS', $db_pass);
|
||||||
|
define('DB', 'palindromes');
|
||||||
|
}
|
||||||
|
|
||||||
// Connect to the DB
|
// Connect to the DB
|
||||||
$conn = mysqli_connect(HOST, USER, PASS, DB);
|
$conn = mysqli_connect(HOST, USER, PASS, DB);
|
||||||
Reference in New Issue
Block a user