Example #1
0
 /**
  * The factory method will load the correct driver for the database-connection,
  * based on the DB_TYPE constant in the '.dbconfig.php' file.
  * It also will check, if driver-only-methods have the DB_TYPE prefix, because of
  * readability and usage. (driver-only-methods are methods of a driver, that not specified in the
  * abstract Database_Driver class)
  *
  * @return Drivers| \Database\Driver_MySQL     return the specific driver-object
  * @throws \LOGD_Exception
  */
 public static function factory()
 {
     //check if we have already an instance of a driver class
     if (null === self::$o_instance) {
         //try to load the specific driver class (check if the class exists),
         //based on the PREFIX with namespace and the database-type.
         //throw an Exception with the corresponding error, which driver class failed
         try {
             $s_class = self::DRIVER_PREFIX . DB_TYPE;
             if (!class_exists($s_class)) {
                 $message = __('error_class_not_found', 'errors') . '<strong>' . $s_class . '</strong><br>';
                 $message .= __('error_wrong_driver', 'errors') . '<strong>' . DB_TYPE . '</strong>';
                 throw new \LOGD_Exception($message, 900);
             }
             //set the current instance-object to the specific driver class and check the methods
             self::$o_instance = new $s_class();
             self::$o_instance->check_methods();
         } catch (\LOGD_Exception $e) {
             $e->print_error();
         }
     }
     return self::$o_instance;
 }
Example #2
0
 $fehler_meldung = "Man benötigt eine gültige ID + dazupassendes Passwort um diesen Teil der Homepage zu besuchen";
 $nameRestricted = "Admin-Bereich";
 // Name des geschützten Bereichs
 // MySQL
 //
 // Die folgenden Einstellungen müssen in der Datei mysql.class.php vorgenommen werden!!!!
 //
 // Konfigurations-Variablen
 //
 // var $mysqlHost="localhost"; // der mysql-host
 // var $mysqlUser="******"; // ein mysql-benutzername
 // var $mysqlPwd="alumniboy"; // dazupassendes Passwort
 // var $mysqlDb="usr_web651_1"; // datenbank in der die tabelle gespeichert wird
 // var $mysqlTabelle="passwort"; // Mysql-Tabelle
 /* Eigentliches Script - nichts mehr ändern */
 $database = new databaseConnection();
 $database->connect();
 if (!isset($PHP_AUTH_USER)) {
     Header("WWW-Authenticate: Basic realm=\"{$nameRestricted}\"");
     Header("HTTP/1.0 401 Unauthorized");
     echo $fehler_meldung;
     exit;
 } else {
     $log = $database->query("select id from " . $database->mysqlTabelle . " where username like '{$PHP_AUTH_USER}' and passwort like '{$PHP_AUTH_PW}'", true);
     if ($log[zeilen] > 0) {
         $loggedin = 1;
     } else {
         Header("WWW-Authenticate: Basic realm=\"{$nameRestricted}\"");
         Header("HTTP/1.0 401 Unauthorized");
         echo $fehler_meldung;
         exit;
Example #3
0
	function deluser() {
		GLOBAL $user,$database;
		$database=new databaseConnection;
		$database->connect();
		for($i=0;$i<count($user);$i++) {
			$database->query("delete from ".$database->mysqlTabelle." where username like '$user[$i]' LIMIT 1");
		}
		$database->disconnect();
		echo "<html>Befehl erfolgreich ausgeführt</html>";		
	}