NorseMan
Member
I have developed this database connection. I took a little from here and a little from there. I began to study it more closely. As I understand this, if this fails, it will release a lot of information to website visitors, such as passwords etc. Actually, the user does not need a lot of error codes if the connection to the DB is not successful. I am the one who needs that information. So how do I keep the print-to-screen information, but without the user on the website getting this information? I'm the only one who needs that information. Heres the script:
<?php
try {
$pdo = new PDO('mysql:host=sql31.mcb.webhuset.no;dbname=**********;
charset=utf8', '**********', '********');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$output = 'No ERROR.';
} catch (PDOException $e) {
$output = 'ERROR: ' . $e;
}
include __DIR__ . '/../templates/output.html.php';
<?php
try {
$pdo = new PDO('mysql:host=sql31.mcb.webhuset.no;dbname=**********;
charset=utf8', '**********', '********');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$output = 'No ERROR.';
} catch (PDOException $e) {
$output = 'ERROR: ' . $e;
}
include __DIR__ . '/../templates/output.html.php';