1
0
This repository has been archived on 2023-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
dtux__nextcloudconnector4do.../db.class.php

57 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?php
2019-09-01 23:01:10 +02:00
require_once("log.php");
class db
{
private $server = "localhost";
private $port = 3306;
private $user = "root";
2019-08-31 14:59:30 +02:00
private $passwd = "Lalis_toor";
2019-08-31 16:07:28 +02:00
public $database;
public $connect;
public $result;
2019-08-31 12:41:48 +02:00
function __construct($database)
{
2019-08-31 15:03:34 +02:00
$this->database = $database;
$this->open();
}
2019-08-31 12:41:48 +02:00
function open()
{
if ( ! $this->connect )
{
$this->connect = new mysqli( $this->server, $this->user, $this->passwd, $this->database );
if ( $this->connect->connect_errno )
{
log_error( "Échec de la connexion : " . " => " . $this->connect->connect_error . "<br />" . __file__ . esp( 'ligne' ) . __line__);
return false;
}
}
return true;
}
function close()
{
$this->connect->close();
$this->connect = 0;
}
function query( $string )
{
if ( empty( $this->connect ) ) $this->open();
$this->result = $this->connect->query( $string ) ;
if ( $this->connect->error ) log_error( "Échec de la commande query" . " => ". $this->connect->error . "<br />" . __file__ . esp( 'ligne' ) . __line__ . "\n" . $string);
}
function error()
{
print_r( $this );
$this->error = $this->error;
return $this->error;
}
}
?>