|
@@ -1,9 +1,38 @@
|
|
|
<?php
|
|
<?php
|
|
|
|
|
+
|
|
|
|
|
+class db {
|
|
|
|
|
+ private $host = 'localhost'; //Host
|
|
|
|
|
+ private $user = 'ban'; //Username
|
|
|
|
|
+ private $pw = 'Blubb123'; //DBpasswort
|
|
|
|
|
+ private $dbname = 'ban'; //Datenbankname
|
|
|
|
|
+
|
|
|
|
|
+ static public $db_obj = null;
|
|
|
|
|
+
|
|
|
|
|
+ private function __construct(){
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ self::$db_obj = new mysqli($this->host, $this->user, $this->pw, $this->dbname);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch(Exception $e)
|
|
|
|
|
+ {
|
|
|
|
|
+ printf('Fehler beim Öffnen der Datenbank.<br><br>%s',
|
|
|
|
|
+ $e->getMessage);
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public static function getInstance(){
|
|
|
|
|
+ if(self::$db_obj === null)
|
|
|
|
|
+ self::$objekt = new db_sql;
|
|
|
|
|
+ return self::$db_obj;
|
|
|
|
|
+ }
|
|
|
|
|
+ private final function __clone(){ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
error_reporting(E_ALL);
|
|
error_reporting(E_ALL);
|
|
|
$ip = trim($_GET['ip']);
|
|
$ip = trim($_GET['ip']);
|
|
|
$token = trim($_GET['token']);
|
|
$token = trim($_GET['token']);
|
|
|
$action = trim($_GET['action']);
|
|
$action = trim($_GET['action']);
|
|
|
-$db = new mysqli('localhost', 'ban', 'Blubb123-', 'ban');
|
|
|
|
|
|
|
+$db = new db;
|
|
|
if ($db->connect_errno){
|
|
if ($db->connect_errno){
|
|
|
die($db->connect_error);
|
|
die($db->connect_error);
|
|
|
}
|
|
}
|