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";
|
||||
$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";
|
||||
$user = 'food-inventory';
|
||||
$password = 'xt3apB8uVbFIYJvp';
|
||||
$PDO = new PDO($dsn, $user, $password);
|
||||
$dsn = $config_array->{"kind"} . ":dbname="
|
||||
. $config_array->{"dbname"} . ";host=" . $config_array->{"host"};
|
||||
$PDO = new PDO($dsn, $config_array->{"user"}, $config_array->{"password"});
|
||||
$PDO->query('SET CHARSET UTF8');
|
||||
|
||||
function is_https()
|
||||
|
Loading…
Reference in New Issue
Block a user