41 lines
		
	
	
		
			919 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			919 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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)
 | 
						|
		{
 | 
						|
			logger(ERROR,_("Connection to sql server error :") . $this->connect_error, __FILE__ . ":" . __LINE__);
 | 
						|
			sleep(5);
 | 
						|
			$flagError = true;
 | 
						|
		}
 | 
						|
		if ($flagError === true)
 | 
						|
		{
 | 
						|
			logger(ERROR, _("Connection to sql server ready"), __FILE__ . ":" . __LINE__);
 | 
						|
		}
 | 
						|
		$this->result = new mysqli_result($this);
 | 
						|
	}
 | 
						|
 | 
						|
	function protect($string)
 | 
						|
	{
 | 
						|
		return $this->real_escape_string($string);
 | 
						|
	}
 | 
						|
}
 | 
						|
$mohaDB = new db();
 | 
						|
 | 
						|
?>
 |