Centralize database configuration for _website folder

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-10-22 01:14:18 +00:00
parent b52f1960f6
commit 490b35c556
3 changed files with 52 additions and 4 deletions

View file

@ -1,10 +1,14 @@
text/x-generic _db.php ( PHP script, ASCII text, with CRLF line terminators )
<?php
$servername = "panel.iaregamer.com";
$username = "remoteuser";
$password = "Pkloyn7yvpht!";
$dbname = "panel";
// Include the centralized database configuration
require_once(__DIR__ . '/includes/config.inc.php');
// Use the configuration variables from config.inc.php
$servername = $db_host;
$username = $db_user;
$password = $db_pass;
$dbname = $db_name;
// Create connection
$db = mysqli_connect($servername, $username, $password, $dbname);

View file

@ -0,0 +1,28 @@
# Website Includes Directory
This directory contains configuration and shared files for the standalone _website folder.
## config.inc.php
Central database configuration file for the website. This file contains the database connection settings that are used by all website PHP files through the `db.php` file.
**Important:** The values in this file should match the panel's database configuration in `/includes/config.inc.php` to ensure the website can access the same database as the panel.
### Configuration Variables
- `$db_host` - Database server hostname
- `$db_user` - Database username
- `$db_pass` - Database password
- `$db_name` - Database name
- `$table_prefix` - Table prefix (default: "ogp_")
- `$db_type` - Database type (default: "mysql")
### Usage
The website files include `db.php`, which in turn loads this configuration file:
```php
require_once('db.php'); // db.php loads includes/config.inc.php
```
This centralizes database credentials in one place, making the website easier to configure and maintain as a standalone site.

View file

@ -0,0 +1,16 @@
<?php
###############################################
# Website Database Configuration
# This file contains the database connection
# settings for the _website standalone site.
#
# These settings should match the panel's
# database configuration in includes/config.inc.php
###############################################
$db_host="localhost";
$db_user="localuser";
$db_pass="Pkloyn7yvpht!";
$db_name="panel";
$table_prefix="ogp_";
$db_type="mysql";
?>