mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
add some additional checking for database errors
This commit is contained in:
parent
8df694b94e
commit
4617cb46a8
2 changed files with 26 additions and 2 deletions
|
@ -20,8 +20,18 @@ class Ticket_User{
|
|||
* @param $permission the permission that will be given to the user. 1=user, 2=mod, 3=admin
|
||||
*/
|
||||
public static function createTicketUser( $extern_id, $permission) {
|
||||
$dbl = new DBLayer("lib");
|
||||
$dbl->insert("ticket_user",array('TUserId' => $extern_id, 'Permission' => $permission, 'ExternId' => $extern_id));
|
||||
try {
|
||||
//make connection with and put into db
|
||||
$dbl = new DBLayer("lib");
|
||||
$dbl->insert("ticket_user",array('TUserId' => $extern_id, 'Permission' => $permission, 'ExternId' => $extern_id));
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
//oh noooz...
|
||||
//error_log(print_r($e, true));
|
||||
//print_r($e);
|
||||
echo "Problem creating user in database!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,20 @@ require_once('setup/version.php');
|
|||
$continue = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($continue) {
|
||||
try {
|
||||
if (!in_array("mysql",PDO::getAvailableDrivers(),TRUE))
|
||||
{
|
||||
throw new PDOException ("Cannot work without a proper database setting up");
|
||||
}
|
||||
}
|
||||
catch (PDOException $pdoEx)
|
||||
{
|
||||
printalert("danger", "PHP PDO seems to be missing the mysql driver");
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Validate basics
|
||||
if ($continue) {
|
||||
|
|
Loading…
Reference in a new issue