summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-04-17 17:13:41 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-04-17 17:13:41 -0600
commit0b045d57b2164b5ce003955d79627ae506a153eb (patch)
tree87caa1a7c232140313ed5eec8ba8ef88409fab83
parente0cbb459e043e931d7ab2d27744b4f3dbb90c0ca (diff)
Change location of config file
The config has been moved inside the project dir and .gitignored. This makes the project work on Windows because Windows does not have a /var directory.
-rw-r--r--.gitignore3
-rw-r--r--README.md4
-rw-r--r--config.example.ini5
-rw-r--r--includes/db_inc.php10
4 files changed, 11 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 600d2d3..394de92 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-.vscode \ No newline at end of file
+.vscode
+config.ini \ No newline at end of file
diff --git a/README.md b/README.md
index 29c11a2..2255372 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
# cflip.net forums
The source code to my first PHP project, a forum system.
-The `setup.sql` should set up the database correctly.
+## Setup
+- Create a `config.ini` file and put your MySQL credentials in (see `config.example.ini`)
+- `setup.sql` has the SQL script to set up your database.
diff --git a/config.example.ini b/config.example.ini
new file mode 100644
index 0000000..c587a63
--- /dev/null
+++ b/config.example.ini
@@ -0,0 +1,5 @@
+[mysql_credentials]
+server = ""
+database = ""
+user = ""
+password = "" \ No newline at end of file
diff --git a/includes/db_inc.php b/includes/db_inc.php
index 10740d8..b7c361d 100644
--- a/includes/db_inc.php
+++ b/includes/db_inc.php
@@ -1,13 +1,5 @@
<?php
-/*
-# Example config values
-[mysql_credentials]
-server = "localhost"
-database = "forum"
-user = "root"
-password = "admin"
-*/
-$cfg_ini = parse_ini_file('/var/www/cflip.ini', true);
+$cfg_ini = parse_ini_file('config.ini', true);
$dbcfg = $cfg_ini['mysql_credentials'];
$db_server = $dbcfg['server'];