From 4a6523cd2da9ccc5a2b4a334e7a33a84f97f1e5b Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Sat, 24 Jun 2017 13:42:16 -0400 Subject: Add creds.php file, attempt to connect to database --- private/controller/Controller.php | 2 + private/model/Connection.php | 23 ++++++++- private/model/creds.php | 103 ++++++++++++++++++++++++++++++++++++++ private/view/Result.php | 4 +- 4 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 private/model/creds.php (limited to 'private') diff --git a/private/controller/Controller.php b/private/controller/Controller.php index 84bd4e7..eda5e13 100644 --- a/private/controller/Controller.php +++ b/private/controller/Controller.php @@ -1,5 +1,7 @@ getHost() . + (($cred->getPort() !== '') ? ";port=" . $cred->getPort() : '') . + ";dbname=" . $cred->getDBName(), + $cred->getLogin(), + $cred->getPassword() + ); + // we destroy $cred as quickly as possible + $cred = null; + } catch (PDOException as $e) { + // we destroy $cred as quickly as possible + $cred = null; + die(json_encode(array("Result-Type" => "Error", "Content" => array($e)))); + } } } diff --git a/private/model/creds.php b/private/model/creds.php new file mode 100644 index 0000000..8ec06ad --- /dev/null +++ b/private/model/creds.php @@ -0,0 +1,103 @@ + "", "Content" => array())); -- cgit