Code suggestions
Posted: Fri Aug 16, 2019 7:53 am
I've got a few ideas for your code, (little ones) but I don't see a github or some such link to offer them.
So here they are. nudatabase.php should fail gracefully if the user doesn't have a config set up correctly.
try {
$nuDB = new PDO("mysql:host=$DBHost;dbname=$DBName;charset=$DBCharset", $DBUser, $DBPassword, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES $DBCharset"));
}
catch ( PDOException $e) {
die($e->getMessage());
}
I'm not sure what's going on with your standalone session, you are checking to see if any var are set and if so, the user must be logged in? This system doesn't work if someone decided to edit the nuconfig.php after attempting to log in incorrectly. (my case). Stuck between active session but not logged in.
I'm not sure of the correct way to do this, but I'm sure this is wrong.
So here they are. nudatabase.php should fail gracefully if the user doesn't have a config set up correctly.
try {
$nuDB = new PDO("mysql:host=$DBHost;dbname=$DBName;charset=$DBCharset", $DBUser, $DBPassword, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES $DBCharset"));
}
catch ( PDOException $e) {
die($e->getMessage());
}
I'm not sure what's going on with your standalone session, you are checking to see if any var are set and if so, the user must be logged in? This system doesn't work if someone decided to edit the nuconfig.php after attempting to log in incorrectly. (my case). Stuck between active session but not logged in.
I'm not sure of the correct way to do this, but I'm sure this is wrong.