aboutsummaryrefslogtreecommitdiff
path: root/private/model/creds.php
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2017-06-24 13:42:16 -0400
committerKevin J Hoerr <kjhoerr@protonmail.com>2017-06-24 13:42:16 -0400
commit4a6523cd2da9ccc5a2b4a334e7a33a84f97f1e5b (patch)
tree4be0e5a8e22d5e5a5dc1e9cf5e218864a61d361e /private/model/creds.php
parent92a7e43b7d4792cdb54eceefd3256324a8eca458 (diff)
downloadaugust-offensive-4a6523cd2da9ccc5a2b4a334e7a33a84f97f1e5b.tar.gz
august-offensive-4a6523cd2da9ccc5a2b4a334e7a33a84f97f1e5b.tar.bz2
august-offensive-4a6523cd2da9ccc5a2b4a334e7a33a84f97f1e5b.zip
Add creds.php file, attempt to connect to database
Diffstat (limited to 'private/model/creds.php')
-rw-r--r--private/model/creds.php103
1 files changed, 103 insertions, 0 deletions
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 @@
+<?php
+
+declare(strict_types = On);
+
+/**
+ * Holds the credentials for connecting to the database
+ */
+class Cred
+{
+ /** @var string $host The destination host that holds the database. */
+ private $host;
+ /** @var string $port The destination port for the database on the host. */
+ private $port;
+ /** @var string $dbname The name of the database of which to connect. */
+ private $dbname;
+ /** @var string $login The username for accessing the database.
+ *
+ * It is recommended to change the login to a more restrictive account once
+ * the tables have been created (e.g. an account that can only insert,
+ * select, and update on that specific database).
+ */
+ private $login;
+ /** @var string $password The password to the account for access. */
+ private $password;
+
+ /**
+ * Sets the values of the credentials.
+ *
+ * @return Cred
+ */
+ public function __construct ()
+ {
+ $host = 'localhost';
+ $port = '5432';
+ $dbname = 'ao';
+ $login = 'r_access';
+ $password = 'secret';
+ }
+
+ /**
+ * Destructor ensures clean wipe of credentials from existing.
+ *
+ * @return void
+ */
+ public function __destruct ()
+ {
+ $host = '';
+ $port = '';
+ $dbname = '';
+ $login = '';
+ $password = '';
+ }
+
+ /**
+ * Returns the value of the host of the database.
+ *
+ * @return string $host
+ */
+ public function getHost ()
+ {
+ return $host;
+ }
+ /**
+ * Returns the value of the port of the host of which to connect.
+ *
+ * @return string $port
+ */
+ public function getPort ()
+ {
+ return $port;
+ }
+ /**
+ * Returns the value of the name of the database of which to connect.
+ *
+ * @return string $dbname
+ */
+ public function getDBName ()
+ {
+ return $dbname;
+ }
+ /**
+ * Returns the value of the username of the account of the database.
+ *
+ * @return string $login
+ */
+ public function getLogin ()
+ {
+ return $login;
+ }
+ /**
+ * Returns the value of the password of the account of the database.
+ *
+ * @return string password
+ */
+ public function getPassword ()
+ {
+ return $password;
+ }
+}
+
+// destroy as quickly as possible
+$cred = new Cred();
+