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__avion-poeme/include/db.class.php
2021-03-22 12:20:39 +01:00

118 lines
2.8 KiB
PHP

<?php
include "log.php";
$table_prefix = "";
class db
{
private $server = "db351634-avionpoeme.sql-pro.online.net";
private $port = 3306;
private $user = "db120904";
private $passwd = "AvionPoème*DB";
private $database = "db351634_avionpoeme";
public $connect;
public $result;
public $uid;
public $message;
public $expeMail;
public $expeKnown;
public $expeLang;
public $destLang;
public $startLat;
public $startLon;
public $startName;
public $startTime;
public $StartTZ;
public $destMail;
public $destLat;
public $destLon;
public $destName;
public $status;
public $color;
public $actual_lat;
public $actual_lon;
public $bearing;
public $deliveryTime;
public $deliveryTZ;
public $deliveryTimeServer;
function __construct()
{
$this->open();
}
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__ . ' ligne ' . __line__);
return false;
}
}
$this->connect->set_charset("utf8");
return true;
}
function close()
{
$this->connect->close();
$this->connect = 0;
}
function protect( $string )
{
return $this->connect->real_escape_string( $string );
}
function query( $string )
{
//log_write( $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__ . ' ligne ' . __line__ . "\n" . $string, true, true);
//print_r( $this );
}
function print_error()
{
print_r( $this );
//$this->error = $this->error;
return $this->connect->error;
}
function newPlane()
{
$query = "INSERT INTO avionpoeme SET (";
$query .= $this->message . ", ";
$query .= $this->expeMail . ", ";
$query .= $this->expeKnown . ", ";
$query .= $this->expeLang . ", ";
$query .= $this->destLang . ", ";
$query .= $this->startLat . ", ";
$query .= $this->startLon . ", ";
$query .= $this->startName . ", ";
$query .= $this->startTime . ", ";
$query .= $this->StartTZ . ", ";
$query .= $this->destMail . ", ";
$query .= $this->destLat . ", ";
$query .= $this->destLon . ", ";
$query .= $this->destName . ", ";
$query .= $this->status . ", ";
$query .= $this->color . ", ";
$query .= $this->actual_lat . ", ";
$query .= $this->actual_lon . ", ";
$query .= $this->bearing . ", ";
$query .= $this->deliveryTime . ", ";
$query .= $this->deliveryTZ . ", ";
$query .= $this->deliveryTimeServer . ", ";
$query .= ")";
}
}
?>