Example #1
1
 public function __construct($host, $user, $pass, $db)
 {
     parent::__construct($host, $user, $pass, $db);
     if (mysqli_connect_error()) {
         die('No se pudo conectar a la base de datos (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
 }
 public function abrir()
 {
     parent::__construct($dbhost = 'p:localhost', $dbuser = '******', $dbpass = '******', $dbname = 'usuario');
     $this->connect_errno ? die('Error con la conexión') : ($x = 'Conectado');
     //echo $x;
     unset($x);
 }
Example #3
0
 public function __construct()
 {
     parent::__construct('localhost', 'root', '', 'xnova');
     $this->query("SET NAMES utf8;");
     date_default_timezone_set('America/Caracas');
     $this->connect_errno ? die('ERROR: Datos incorrectos en /core/models/class.Connect.php') : null;
 }
Example #4
0
 public function __construct($host, $user, $password, $database)
 {
     $link_id = @parent::__construct($host, $user, $password, $database);
     if (mysqli_connect_error()) {
         die('<b>Fehler beim Verbinden!</b><br>Connect Errno: ' . mysqli_connect_errno() . '<br>Connect Error: ' . mysqli_connect_error());
     }
 }
Example #5
0
 public function __construct($host = false, $user = false, $pass = false, $dbname = "", $port = false, $socket = false)
 {
     if ($host === false && $socket === false) {
         $host = ini_get("mysqli.default_host");
     }
     if ($user === false) {
         $user = ini_get("mysqli.default_user");
     }
     if ($pass === false) {
         $pass = ini_get("mysqli.default_pw");
     }
     if ($port === false) {
         $port = ini_get("mysqli.default_port");
     }
     if ($socket === false && $host === false) {
         $socket = ini_get("mysqli.default_socket");
     }
     parent::__construct($host, $user, $pass, $dbname, $port, $socket);
     if ($this->connect_error) {
         throw new Expection('mysqlii: Connect Error (' . $this->connect_errno . ') ' . $this->connect_error);
     }
     #initialise the connection for killing queries
     $this->killConnection = new mysqli($host, $user, $pass, $dbname, $port, $socket);
     if ($this->killConnection->connect_error) {
         throw new Expection('mysqlii: Connect Error in Kill Connection (' . $this->killConnection->connect_errno . ') ' . $this->{$killConnection}->connect_error);
     }
 }
Example #6
0
 /**
  * Adb constructor.
  *
  * Function to establish a connection each time
  * the adb class is instantiated. The constructor
  * takes in the host, username, password, the name
  * of the database and the port as its parameters
  *
  * @internal param string $host
  * @internal param string $username
  * @internal param string $passwd
  * @internal param string $dbname
  * @internal param int $port
  */
 public function __construct()
 {
     parent::__construct(DB_HOST, DB_USER, DB_PWORD, DB_NAME, DB_PORT);
     if (mysqli_connect_error()) {
         die('Connection Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
 }
Example #7
0
 function __construct($host, $user, $pass, $db)
 {
     parent::__construct($host, $user, $pass, $db);
     if ($this->connect_error) {
         die('Connect Error (' . $this->connect_errno . ') ' . $this->connect_error);
     }
 }
Example #8
0
 private function __construct()
 {
     @parent::__construct(core_settings::i()->get('CONFIG_SERVERS_DATABASE_IP'), core_settings::i()->get('CONFIG_SERVERS_DATABASE_USERNAME'), core_settings::i()->get('CONFIG_SERVERS_DATABASE_PASSWORD'), core_settings::i()->get('CONFIG_SERVERS_DATABASE_DATABASE'), core_settings::i()->get('CONFIG_SERVERS_DATABASE_PORT'));
     if ($this->connect_errno) {
         throw new Exception("Cannot Connect to Database: " . $this->connect_error);
     }
 }
Example #9
0
 /**
  * @name __construct
  * @param $host host for the mysql connection
  * @param $user user for the mysql connection
  * @param @pass password for the mysql connection
  * @param $db schema to work with
  * @param $port port for the mysql connection
  * @param $socket socket for the mysql connection
  **/
 function __construct($host = 'localhost', $user = null, $pass = null, $db = null, $port = null, $socket = null)
 {
     @parent::__construct($host, $user, $pass, $db, $port, $socket);
     if ($this->connect_errno != 0) {
         $this->build_error('connect');
     }
 }
 public function __construct($options = array())
 {
     $default = array('mysql_data' => NULL, 'repertoire' => '/');
     $options = array_merge($default, $options);
     extract($options);
     $this->host = $mysql_data['host'];
     $this->port = $mysql_data['port'];
     $this->user = $mysql_data['user'];
     $this->pass = $mysql_data['pass'];
     $this->bdd = $mysql_data['bdd'];
     $this->socket = $mysql_data['socket'];
     $this->charset = $mysql_data['charset'];
     $this->collation = $mysql_data['collation'];
     $this->data_directory = $mysql_data['data_directory'];
     @parent::__construct($this->host, $this->user, $this->pass, $this->bdd, $this->port, $this->socket);
     if ($this->connect_error) {
         $this->bkp_errors[] = 'Une erreur s\'est produite lors de la connexion aux bases de données';
         return;
     }
     $this->repertoire = $repertoire;
     if (!is_dir($this->repertoire)) {
         $this->bkp_errors[] = 'Une erreur s\'est produite lors l\'accès au répertoire &laquo; ' . htmlspecialchars($this->repertoire) . ' &raquo;';
         return;
     }
     $this->nom_fichier = $this->bdd . '.sql';
     $this->fichier = @fopen($this->repertoire . $this->nom_fichier, 'w');
     if (!$this->fichier) {
         $this->bkp_errors[] = 'Une erreur s\'est produite lors de l\'écriture du fichier &quot;' . htmlspecialchars($this->nom_fichier) . '&quot;';
         return;
     }
     $this->generer();
     $this->bkp_errors = array();
 }
Example #11
0
 public function __construct()
 {
     parent::__construct(HOST, NOMUSUARI, CONTRASENYA, NOMBDD);
     if (mysqli_connect_error()) {
         die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
 }
Example #12
0
 public function __construct($host, $username, $password, $database)
 {
     parent::__construct("{$host}", "{$username}", "{$password}", "{$database}");
     if (mysqli_connect_error()) {
         die('Could not connect: ' . mysqli_connect_error());
     }
 }
Example #13
0
 /**
  * Constructeur
  * @param array $options
  */
 public function __construct($options = array())
 {
     $default = array('host' => ini_get('mysqli.default_host'), 'username' => ini_get('mysqli.default_user'), 'passwd' => ini_get('mysqli.default_pw'), 'dbname' => '', 'port' => ini_get('mysqli.default_port'), 'socket' => ini_get('mysqli.default_socket'), 'dossier' => './sql/', 'nbr_fichiers' => 5, 'nom_fichier' => 'backup_');
     $options = array_merge($default, $options);
     extract($options);
     // Connexion de la connexion DB
     @parent::__construct($host, $username, $passwd, $dbname, $port, $socket);
     if ($this->connect_error) {
         $this->message('Erreur de connexion (' . $this->connect_errno . ') ' . $this->connect_error);
         return;
     }
     // Controle du dossier
     $this->dossier = $dossier;
     if (!is_dir($this->dossier)) {
         $this->message('Erreur de dossier &quot;' . htmlspecialchars($this->dossier) . '&quot;');
         return;
     }
     // Controle du fichier
     $this->nom_fichier = $nom_fichier . date('Ymd-His') . '.sql.gz';
     $this->gz_fichier = @gzopen($this->dossier . $this->nom_fichier, 'w');
     if (!$this->gz_fichier) {
         $this->message('Erreur de fichier &quot;' . htmlspecialchars($this->nom_fichier) . '&quot;');
         return;
     }
     // Demarrage du traitement
     $this->sauvegarder();
     $this->purger_fichiers($nbr_fichiers);
 }
Example #14
0
 private function __construct()
 {
     parent::__construct(DB_HOST, DB_USER, DB_PASS, DB_NAME);
     if (mysqli_connect_errno()) {
         throw new Exception(mysqli_connect_error(), mysqli_connect_errno());
     }
 }
Example #15
0
 function __construct()
 {
     parent::__construct("henrikh.dyndns.org", "webprosjekt", "web123", "web_prosjekt", "3306");
     if (mysqli_connect_error()) {
         die("Kunne ikke opprette tilkobling til databasen: (" . mysqli_connect_errno() . ") " . mysqli_connect_error());
     }
 }
Example #16
0
 /**
  * Método constructor de la clase que representa una conexión entre PHP y la base de datos MySQL
  */
 public function __construct()
 {
     parent::__construct($this->host, $this->usuario, $this->contraseña, $this->bd);
     if (mysqli_connect_error()) {
         die('Error de Conexión (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
 }
Example #17
0
 public function __construct()
 {
     parent::__construct("localhost", "nr1c2syb_terres", "haO{v3A4M5dE", "nr1c2syb_terrestv");
     if (mysqli_connect_error()) {
         die('Error connexió (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
 }
Example #18
0
 public function __construct()
 {
     parent::__construct(DB_HOST, DB_USER, DB_PASS, DB_NAME);
     $this->query("SET NAMES utf8;");
     date_default_timezone_set('America/Guayaquil');
     $this->connect_errno ? die('ERROR: Datos incorrectos en /core/models/class.Connect.php') : null;
 }
Example #19
0
 public function __construct($name)
 {
     parent::__construct();
     parent::setName($name);
     self::setConnection(mysqli::__construct(DB_HOST, DB_USER, DB_PASS, DB_SCHEMA));
     self::_testForCacheDateTable();
 }
Example #20
0
 /**
  * Construct the Database 
  *
  * Since this extends MySQL all the MySQL construct params are kept in tact. 
  * However, you may just supply an object with the following properties if you prefer: 
  * $o->dbUser, $o->dbPass, $o->dbHost, $o->dbName, $config->dbPort, $config->dbSocket (optional).
  * This would usually be from a ProcessWire Config ($config) API var, but kept as generic object
  * in case someone wants to use this class elsewhere. 
  * 
  * @param string|Config $host Hostname or object with config properties. 
  * @param string $user Username
  * @param string $pass Password
  * @param string $db Database name
  * @param int $port Port
  * @param string $socket Socket
  * @throws WireDatabaseException
  * 
  */
 public function __construct($host = 'localhost', $user = null, $pass = null, $db = null, $port = null, $socket = null)
 {
     if (is_object($host) && $host->dbHost) {
         $config = $host;
         $host = $config->dbHost;
         $user = $config->dbUser;
         $pass = $config->dbPass;
         $db = $config->dbName;
         $port = $config->dbPort;
         $socket = $config->dbSocket ? $config->dbSocket : null;
     } else {
         $config = null;
     }
     @parent::__construct($host, $user, $pass, $db, $port, $socket);
     if (mysqli_connect_error()) {
         throw new WireDatabaseException("DB connect error " . mysqli_connect_errno() . ' - ' . mysqli_connect_error());
     }
     if ($config) {
         if ($config->dbCharset) {
             $this->set_charset($config->dbCharset);
         } else {
             if ($config->dbSetNamesUTF8) {
                 $this->query("SET NAMES 'utf8'");
             }
         }
     }
 }
Example #21
0
 public function __construct()
 {
     parent::__construct('localhost', 'root', '', 'grieta');
     $this->query("SET NAMES 'utf8';");
     $this->connect_errno ? die('Error de conexion') : ($x = 'conectado');
     #echo $x;
     #unset($x);
 }
Example #22
0
 public function __construct()
 {
     parent::__construct('localhost', 'root', '', 'ajax');
     $this->query("SET NAMES 'utf8'");
     $this->connect_errno ? die('Error al conectar') : ($x = "Conexion exitosa");
     // echo $x;
     // unset($x);
 }
 public function __construct()
 {
     parent::__construct('localhost', 'root', '', 'db_smgroup');
     $this->query("SET NAMES 'utf8';");
     $this->connect_errno == true ? dir('Error en la conexion') : ($conexion = 'conectado');
     // echo $conexion;
     unset($conexion);
 }
Example #24
0
 /**	__construct
  *	Starts a mysqli connection
  *
  *	@param	string	$host Host
  *	@param	string	$user User
  *	@param	string	$pass Password
  *	@param	string	$database Database
  *
  * 	@return void
  */
 public function __construct($host, $user, $pass, $database)
 {
     parent::__construct($host, $user, $pass, $database);
     $this->set_charset("utf8");
     if (mysqli_error($this)) {
         throw new Exception(mysqli_error($this), mysqli_errno($this));
     }
 }
Example #25
0
	private function __construct($server = "localhost", $username = "", $password = "", $schema = ""){
		$this->database = $schema;
		
		// Prevents mysql sock warnings. I prefer to throw exception as below.
		@parent::__construct($server, $username, $password, $schema);
		if ($this->connect_error) throw new Exception("Connect Error ({$this->connect_errno}) {$this->connect_error}", self::ERR_CONNECT_ERROR);
		if(!@parent::ping()) throw new Exception("Database server unavailable", self::ERR_UNAVAILABLE);
	}
Example #26
0
 private function __construct($dbHost, $dbUser, $dbPassword, $dbName)
 {
     parent::__construct($dbHost, $dbUser, $dbPassword, $dbName);
     if ($this->connect_error) {
         echo 'Connection failed! ' . $this->connect_error;
         self::$instance = null;
     }
 }
Example #27
0
 public function __construct($host, $user, $pass, $db)
 {
     parent::__construct($host, $user, $pass, $db);
     $this->thisClass = get_class($this);
     if (mysqli_connect_error()) {
         die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
 }
 public function __construct()
 {
     parent::__construct('localhost', 'satelimp_pqr', 'satelimp_pqr', 'satelimp_pqr');
     $this->query("SET NAMES 'utf8';");
     $this->connect_errno ? die('Error con la conexion') : ($x = 'Conectado');
     /*echo $x;*/
     unset($x);
 }
Example #29
0
 private function __construct()
 {
     parent::__construct($this->dbHost, $this->user, $this->pass, $this->dbName);
     if (mysqli_connect_error()) {
         exit('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
     parent::set_charset('utf-8');
 }
Example #30
0
 public function __construct()
 {
     parent::__construct('localhost', 'username', 'password', 'hs_stats');
     if (mysqli_connect_error()) {
         die('Database error: ' . mysqli_connect_error());
     }
     $this->connected = true;
 }