2023-12-06 08:33:25 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ppb\Model;
|
|
|
|
|
|
|
|
use ppb\Library\Msg;
|
|
|
|
|
|
|
|
abstract class Database {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Zugangsdaten für die Datenbank
|
|
|
|
*/
|
2023-12-14 16:59:16 +01:00
|
|
|
private $dbName = "pbs2h22aal_SubwaySurfers"; //Datenbankname
|
2023-12-06 08:33:25 +01:00
|
|
|
private $linkName = "mysql.pb.bib.de"; //Datenbank-Server
|
|
|
|
//Administration: https://mysql.pb.bib.de/phpMyAdmin/
|
|
|
|
private $user = "pbs2h22aal"; //Benutzername
|
|
|
|
private $pw = "Iggibib!"; //Passwort
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stellt eine Verbindung zur Datenbank her
|
|
|
|
*
|
|
|
|
* @return \PDO Gibt eine Datenbankverbindung zurueck
|
|
|
|
*/
|
|
|
|
public function linkDB() {
|
|
|
|
try {
|
|
|
|
$pdo = new \PDO("mysql:dbname=$this->dbName;host=$this->linkName"
|
|
|
|
, $this->user
|
|
|
|
, $this->pw
|
|
|
|
, array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION));
|
|
|
|
return $pdo;
|
|
|
|
} catch (\PDOException $e) {
|
|
|
|
new Msg(true, null, $e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|