1
0
moha/webserver/class/db.class.php

41 lines
919 B
PHP
Raw Permalink Normal View History

2022-04-23 02:00:52 +02:00
<?php
//logger(DEBUG, _("Including db.php"));
class db extends mysqli
{
public $mysqlServer = "127.0.0.1"; // Your production server
public $username = "moha";
public $passwd = "MysqlMoha";
public $database = "moha";
public $result;
function __construct()
{
global $testMode;
$flagError = false;
if ($testMode)
{
$this->mysqlServer = "192.168.1.253"; // Your test server
}
while ($this->connect($this->mysqlServer, $this->username, $this->passwd, $this->database) === false)
{
2022-05-05 21:28:26 +02:00
logger(ERROR,_("Connection to sql server error :") . $this->connect_error, __FILE__ . ":" . __LINE__);
2022-04-23 02:00:52 +02:00
sleep(5);
$flagError = true;
}
if ($flagError === true)
{
2022-05-05 21:28:26 +02:00
logger(ERROR, _("Connection to sql server ready"), __FILE__ . ":" . __LINE__);
2022-04-23 02:00:52 +02:00
}
2022-05-05 21:28:26 +02:00
$this->result = new mysqli_result($this);
2022-04-23 02:00:52 +02:00
}
function protect($string)
{
return $this->real_escape_string($string);
}
}
2022-05-05 21:28:26 +02:00
$mohaDB = new db();
2022-04-23 02:00:52 +02:00
?>