bjorn / rpgdx

RPGDX
http://rpgdx.net
2 stars 3 forks source link

Document how to create database_connect.php #7

Closed Poikilos closed 3 months ago

Poikilos commented 3 months ago

includes/database.php includes database_connect.php but that file doesn't exist. Could forums/config.php be used instead, or could there be a static database_connect.php without private data, that instead relies on config.php?

bjorn commented 3 months ago

The live setup actually doesn't use such a file but simply has local edits to connect to the database. But in fact, this snippet could indeed just be replaced with:

// Connect to the MySQL server
include_once('forums/config.php');
$mysql_connection = @mysql_connect($dbhost, $dbuser, $dbpasswd) or print("<b>Warning:</b> Unable to connect to MySQL database.<br />\n". mysql_error());
mysql_select_db($dbname);

The above is adjusted from the live code, but if you open a PR for this part (or include it in your PHP8 one), feel free to update/improve as appropriate.

The variable $mysql_connection is not actually used anywhere, not sure if it is needed in that case.

bjorn commented 3 months ago

This turned out even easier. :)