<?php
/*
Copyright (C) 2007 Mercier Benjamin

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
*/
// Fichier Core : Inclusion et connexion a MySql

// Inclusion de la class mysql
require ('system/class.mysql.php');

// Déclaration du serveur :
$ServeurFichier = "";
$ServeurMySql   = "";

// Base de données Panel :
$Connexion["Panel"]["Serveur"]  = "";
$Connexion["Panel"]["Login"]    = "root_panel";
$Connexion["Panel"]["Database"] = "root_panel";
$Connexion["Panel"]["Passwd"]   = "";

// Base de données System :
$Connexion["System"]["Serveur"]  = "";
$Connexion["System"]["Login"]    = "root_system";
$Connexion["System"]["Database"] = "root_system";
$Connexion["System"]["Passwd"]   = "";

// Identifiant serveur local (Uniquement si un serveur MySql est définit) :
$Connexion["Local"]["Serveur"]  = "";
$Connexion["Local"]["Login"]    = "";
$Connexion["Local"]["Database"] = "";
$Connexion["Local"]["Passwd"]   = "";


/* ---------------------------------------- */
/* ---------------------------------------- */
/* ---------------------------------------- */

// Afficharge de l'heure
echo "---------------------------\n";
echo "--> ".date ("d-m-Y H:i:s")." <--\n";
echo "---------------------------\n\n";

// Connexion MySql au panel :
$ConnexionPanel = new MySql ($Connexion["Panel"]["Serveur"], $Connexion["Panel"]["Database"], $Connexion["Panel"]["Login"], $Connexion["Panel"]["Passwd"]);
if ( $ConnexionPanel->id_connect == FALSE ) 
	{
	die ("Erreur : Connexion a la bdd panel échoué");
	}
else
	{
	echo "Connexion a la bdd panel reussie\n";
	}
	
// Connexion MySql au system :
$ConnexionSystem = new MySql ($Connexion["System"]["Serveur"], $Connexion["System"]["Database"], $Connexion["System"]["Login"], $Connexion["System"]["Passwd"]);
if ( $ConnexionSystem->id_connect == FALSE )
	{
	die ("Erreur : Connexion a la bdd system échoué");
	}
else
	{
	echo "Connexion a la bdd system reussie\n";
	}
	
// Connexion au serveur MySql local :
if ( !empty($ServeurMySql) )
	{
	if ( !isset($ConnexionLocale) )
		{
		$ConnexionLocale = new MySql ($Connexion["Local"]["Serveur"], $Connexion["Local"]["Database"], $Connexion["Local"]["Login"], $Connexion["Local"]["Passwd"]);
		if ( $ConnexionLocale->id_connect == FALSE )
			{
			die ("Erreur : Connexion au serveur MySql local échoué");
			}
		else
			{
			echo "Connexion au serveur MySql local reussie\n";
			}
		}
	}
	
echo "---------------------------\n\n";

?>
