function connection_mysql($er_connec = 1, $my_bd = '', $bd = 1, $er_bd = 1)
 {
     global $opac_nb_documents;
     global $charset, $SQL_MOTOR_TYPE;
     global $charset, $SQL_MOTOR_TYPE, $time_zone, $time_zone_mysql;
     if (isset($time_zone) && trim($time_zone)) {
         date_default_timezone_set($time_zone);
     }
     //Pour l'heure PHP
     $my_connec = @pmb_mysql_connect(SQL_SERVER, USER_NAME, USER_PASS);
     if ($my_connec == 0 && $er_connec == 1) {
         die(my_error(0));
     }
     if ($bd) {
         $my_bd == '' ? $my_bd = DATA_BASE : $my_bd;
         if (pmb_mysql_select_db($my_bd, $my_connec) == 0 && $er_bd == 1) {
             die(my_error(0));
         }
     }
     $opac_nb_documents = @pmb_mysql_result(pmb_mysql_query("select count(*) from notices", $my_connec), 0, 0) * 1;
     if ($charset == 'utf-8') {
         pmb_mysql_query("set names utf8 ", $my_connec);
     } else {
         pmb_mysql_query("set names latin1 ", $my_connec);
     }
     if ($SQL_MOTOR_TYPE) {
         pmb_mysql_query("set storage_engine={$SQL_MOTOR_TYPE}", $my_connec);
     }
     if (isset($time_zone_mysql) && trim($time_zone_mysql)) {
         pmb_mysql_query("SET time_zone = {$time_zone_mysql}", $my_connec);
     }
     //Pour l'heure MySQL
     return $my_connec;
 }
Пример #2
0
 /**
  * Internal command to connect to the database
  * @return void
  */
 private function connectToDb()
 {
     if (!($this->dbConn = @pmb_mysql_connect($this->host, $this->dbUser, $this->dbPass))) {
         $this->handleError();
         return false;
     } else {
         if (!@pmb_mysql_select_db($this->dbName, $this->dbConn)) {
             $this->handleError();
             return false;
         }
     }
 }
Пример #3
0
function connection_mysql($er_connec = 1, $my_bd = '', $bd = 1, $er_bd = 1)
{
    global $__erreur_cnx_base__, $pmb_nb_documents, $pmb_opac_url, $pmb_bdd_version;
    global $charset, $SQL_MOTOR_TYPE, $time_zone, $time_zone_mysql;
    if (isset($time_zone) && trim($time_zone)) {
        date_default_timezone_set($time_zone);
    }
    //Pour l'heure PHP
    $my_connec = @pmb_mysql_connect(SQL_SERVER, USER_NAME, USER_PASS);
    if ($my_connec == 0 && $er_connec == 1) {
        $__erreur_cnx_base__ = 'erreur ' . pmb_mysql_errno() . ' : ' . pmb_mysql_error() . '<br />';
        return 0;
    }
    if ($bd) {
        $my_bd == '' ? $my_bd = DATA_BASE : $my_bd;
        if (pmb_mysql_select_db($my_bd, $my_connec) == 0 && $er_bd == 1) {
            $__erreur_cnx_base__ = 'erreur ' . pmb_mysql_errno() . ' : ' . pmb_mysql_error() . '<br />';
            return 0;
        }
    }
    $pmb_nb_documents = @pmb_mysql_result(pmb_mysql_query("select count(*) from notices", $my_connec), 0, 0) * 1;
    $pmb_opac_url = @pmb_mysql_result(pmb_mysql_query("select valeur_param from parametres where type_param='pmb' and sstype_param='opac_url'", $my_connec), 0, 0);
    $pmb_bdd_version = @pmb_mysql_result(pmb_mysql_query("select valeur_param from parametres where type_param='pmb' and sstype_param='bdd_version'", $my_connec), 0, 0);
    if ($charset == 'utf-8') {
        pmb_mysql_query("set names utf8 ", $my_connec);
    } else {
        pmb_mysql_query("set names latin1 ", $my_connec);
    }
    if ($SQL_MOTOR_TYPE) {
        pmb_mysql_query("set storage_engine={$SQL_MOTOR_TYPE}", $my_connec);
    }
    if (isset($time_zone_mysql) && trim($time_zone_mysql)) {
        pmb_mysql_query("SET time_zone = {$time_zone_mysql}", $my_connec);
    }
    //Pour l'heure MySQL
    return $my_connec;
}
// $Id: transfertdata_upload.php,v 1.5 2015-04-03 11:16:24 jpermanne Exp $
//Restauration d'urgence
exit;
$base_path = "../../..";
include_once "{$base_path}/includes/error_report.inc.php";
include_once "{$base_path}/includes/global_vars.inc.php";
require_once "{$base_path}/includes/config.inc.php";
$include_path = $base_path . "/" . $include_path;
require_once "{$include_path}/db_param.inc.php";
if ($_tableau_databases[1] && $base_title) {
    // multi-databases
    $database_window_title = $_libelle_databases[array_search(LOCATION, $_tableau_databases)] . ": ";
} else {
    $database_window_title = "";
}
@($link = pmb_mysql_connect($_POST["host"], $_POST["db_user"], $_POST["db_password"])) or die("Impossible de se connecter au serveur MySql en tant qu'admin USER_NAME ");
// Le @ ordonne a php de ne pas afficher de message d'erreur
@pmb_mysql_select_db($_POST["db"]) or die("Impossible de se connecter à la base de données {$dbnamedbhost}");
##### Faire saisir le nom de la bdd, les mots de passe pour securite... et se connecter ensuite. faire quand meme un include db_include pour savoir le charset destination.
move_uploaded_file($_FILES['archive_file']['tmp_name'], "../../backup/backups/" . $_FILES['archive_file']['tmp_name']);
function restore($src)
{
    global $link;
    global $buffer_sql;
    $SQL = '';
    if ($src) {
        $filename = $src;
        if (open_restore_stream($src) && $buffer_sql) {
            // open source file
            $SQL = preg_split('/;\\s*\\n|;\\n/m', $buffer_sql);
            for ($i = 0; $i < sizeof($SQL); $i++) {
Пример #5
0
     // Le @ ordonne a php de ne pas afficher de message d'erreur
     $ligne = "DROP DATABASE {$dbname}";
     @pmb_mysql_query($ligne, $link);
     $ligne = "CREATE DATABASE {$dbname} ";
     $ligne .= "character set utf8 COLLATE utf8_unicode_ci";
     if (!pmb_mysql_query($ligne, $link)) {
         echo $msg_nodb;
         exit(0);
     }
     echo $msg_okdb;
     $sql_userbibli = "GRANT SELECT ,INSERT ,UPDATE ,DELETE ,CREATE ,DROP ,INDEX ,ALTER ,CREATE TEMPORARY TABLES ,LOCK TABLES ON " . $dbname . ".* to {$user}@localhost identified by '{$password}' ";
     pmb_mysql_query($sql_userbibli, $link);
     pmb_mysql_query("flush privileges ", $link);
     pmb_mysql_close($link);
     // fermeture de la connexion en tant que root
     @($link = pmb_mysql_connect($dbhost, $user, $password)) or die("Impossible de se connecter au serveur MySql en tant que {$user} ");
     // Le @ ordonne a php de ne pas afficher de message d'erreur
     @pmb_mysql_select_db($dbname) or die("Impossible de se connecter à la base de données {$dbname}");
     pmb_mysql_query("set names utf8 ", $link);
     echo $msg_okconnect_user;
     create_db_param($dbhost, $user, $password, $dbname, $charset);
 }
 //Suppression des fichiers temporaires gestion opac
 del_fic_temp("../opac_css/temp/");
 //Suppression des fichiers temporaires gestion
 del_fic_temp("../temp/");
 if (!$data_test_cms) {
     if (restore("bibli.sql")) {
         print $msg_crea_01;
     } else {
         print $msg_crea_02;
Пример #6
0
}
//Récupération du nom de fichier
$tFilename = explode("/", $filename);
$file_name = $tFilename[count($tFilename) - 1];
$user = $db_user;
$password = $db_password;
require_once "../../classes/crypt.class.php";
function abort($message)
{
    echo "<script>alert(\"{$message}\"); history.go(-1);</script>";
    exit;
}
print "<div id=\"contenu-frame\">\n";
echo "<center><h1>" . sprintf($msg["sauv_misc_restaure"], $file_name) . "</h1></center>\n";
if ($critical == 1) {
    $dbh = pmb_mysql_connect($host, $user, $password) or abort($msg["sauv_misc_ract_cant_connect"]);
    pmb_mysql_select_db($db) or abort(sprintf($msg["sauv_misc_ract_db_dont_exists"], $db));
}
//Récupération de la partie data
$f = fopen($filename, "r") or abort($msg["sauv_misc_ract_cant_open_file"]);
$line = fgets($f, 4096);
$line = rtrim($line);
while (!feof($f) && $line != "#data-section") {
    $line = fgets($f, 4096);
    $line = rtrim($line);
}
if ($line != "#data-section") {
    abort($msg["sauv_misc_ract_no_sauv"]);
}
/*$datas=fread($f,filesize($filename));
Пример #7
0
$base_nocheck = 1;
$base_nobody = 1;
$base_nosession = 1;
include $base_path . "/includes/init.inc.php";
include $base_path . "/admin/convert/export.class.php";
include $base_path . "/admin/convert/xml_unimarc.class.php";
require_once $base_path . "/classes/search.class.php";
require_once $base_path . "/includes/isbn.inc.php";
$corresp = array("1016" => "42", "4" => "1", "1003" => "2", "1018" => "3", "31" => "23", "5" => "4", "7" => "22", "8" => "22", "21" => "13");
$corresp_op = array("1016" => "BOOLEAN", "4" => "BOOLEAN", "1003" => "BOOLEAN", "1018" => "BOOLEAN", "31" => "CONTAINS_AT_LEAST", "5" => "BOOLEAN", "7" => "STARTWITH", "8" => "STARTWITH", "21" => "BOOLEAN");
function make_error($nerr, $err_message)
{
    echo $nerr . "@" . $err_message . "@";
    exit;
}
if (!@pmb_mysql_connect(SQL_SERVER, USER_NAME, USER_PASS)) {
    make_error(1, "Could'nt connect to database server");
}
if (!@pmb_mysql_select_db(DATA_BASE)) {
    make_error(2, "Database unknown");
}
//Commande envoyée
$command = $_GET["command"];
//Requete
$query = $_GET["query"];
function traite_val($value, $idf)
{
    switch ($idf) {
        case "22":
            if (isISBN($value)) {
                // si la saisie est un ISBN