_dbhost, $this->_dbuser, $this->_dbpass, $this->_dbname); $sql = 'SELECT * FROM y_conf WHERE admin=' . self::admin . ' AND active=1 LIMIT 1;'; $mysqli->set_charset("utf8"); $res = $mysqli->query($sql); $resconf = $res->fetch_assoc(); $this->_appenv = $resconf["appenv"]; $this->_appversion = $resconf["appversion"]; $this->_appscript = $resconf["appscript"]; //! le script à appeler par défaut si l'utilisateur n'est pas reconnu $this->_brandgroupe = $resconf["brandgroupe"]; $this->_brandmulti = $resconf["brandmulti"]; //! On va chercher les infos de base de cette appname dans ce_frontal.users_entites en fonction du http_host $http_host = $_SERVER['HTTP_HOST']; error_log("http_host : ".$http_host); $sql = 'SELECT * FROM users_entites WHERE http_host LIKE "%' . $http_host . '%" AND active=1 LIMIT 1;'; $res = $mysqli->query($sql); $mysqli->close(); $resentite = $res->fetch_assoc(); if (empty($resentite)) { //! on ne trouve pas ce http_host, on part sur la demo $this->_appname = "udo_demo"; $mysqli = new mysqli($this->_dbhost, $this->_dbuser, $this->_dbpass, $this->_dbname); $sql = 'SELECT * FROM users_entites WHERE rowid=1;'; // appname="' . $this->_appname . '" AND active=1 LIMIT 1;'; $res = $mysqli->query($sql); $mysqli->close(); $resentite = $res->fetch_assoc(); } $this->_entite = $resentite; $this->_appname = $resentite["appname"]; $this->_apptitle = $resentite["libelle"]; $this->_brandname = $resentite["libelle"]; $this->_brandadresse1 = $resentite["adresse1"]; $this->_brandadresse2 = $resentite["adresse2"]; $this->_brandcp = $resentite["cp"]; $this->_brandville = $resentite["ville"]; $this->_brandtel = $resentite["tel1"]; $this->_brandemail = $resentite["email"]; $this->_brandlogo = $resentite["appname"]; $this->_dbgname = $resentite["groupebase"]; $this->_dbuname = $resentite["genbase"]; $this->_tbusers = $resentite["table_users_gen"]; //! Spécifie la table des users de cette application, par défaut dans uof_frontal.users if (!empty($_SERVER["HTTP_CLIENT_IP"])) { $this->_clientIp = $_SERVER["HTTP_CLIENT_IP"]; } elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { $this->_clientIp = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else { $this->_clientIp = $_SERVER["REMOTE_ADDR"]; } //if ($this->_clientIp == $this->_excludeIp) { ini_set('error_reporting', -1); ini_set('display_errors', '1'); // $this->_devIp = true; //} else { // ini_set('error_reporting', 0); // ini_set('display_errors', '0'); //} } }