added a better way to store credentials
This commit is contained in:
parent
fafedd38f6
commit
4141eaf3ea
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
./assets/php/config.json
|
assets/php/config.json
|
7
assets/php/example_config.json
Normal file
7
assets/php/example_config.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"host":"localhost",
|
||||||
|
"dbname": "db",
|
||||||
|
"user": "user",
|
||||||
|
"password": "pass",
|
||||||
|
"kind": "mysql"
|
||||||
|
}
|
@ -3,11 +3,11 @@
|
|||||||
$SESSION_COOKIE_NAME = "connection_id";
|
$SESSION_COOKIE_NAME = "connection_id";
|
||||||
$MAX_COOKIE_LIFE = time() + 86400 * 30; // 30 days max
|
$MAX_COOKIE_LIFE = time() + 86400 * 30; // 30 days max
|
||||||
|
|
||||||
|
$config_array = json_decode(file_get_contents("config.json", true));
|
||||||
|
|
||||||
$dsn = "mysql:dbname=food-inventory;host=localhost";
|
$dsn = $config_array->{"kind"} . ":dbname="
|
||||||
$user = 'food-inventory';
|
. $config_array->{"dbname"} . ";host=" . $config_array->{"host"};
|
||||||
$password = 'xt3apB8uVbFIYJvp';
|
$PDO = new PDO($dsn, $config_array->{"user"}, $config_array->{"password"});
|
||||||
$PDO = new PDO($dsn, $user, $password);
|
|
||||||
$PDO->query('SET CHARSET UTF8');
|
$PDO->query('SET CHARSET UTF8');
|
||||||
|
|
||||||
function is_https()
|
function is_https()
|
||||||
|
Loading…
Reference in New Issue
Block a user