connect($Connexion->dbname); $auth = new Auth($_POST["login"],$_POST["pwd"]); //if ($_COOKIE['PHPSESSID']) //{ //} ?> exec("SELECT appli.GetPassword('users','".$auth->getValue("appli_user")."')"); $Connexion->setRow(-1);$Connexion->nextRow();$rs=$Connexion->fobject(); if ( ($rs->getpassword == _POSTGRESQL_ERROR_) || ($rs->getpassword <> $auth->getValue("appli_mdp")) ) { include("session_failed.php"); } else { /* Les login et mot de passe sont exacts, on récupère donc les paramètres samba pour le réseau */ $Connexion->exec("SELECT * FROM appli.GetRezoParametersFromUserLogin('".$auth->getValue("appli_user")."')"); $Connexion->setRow(-1);$Connexion->nextRow();$rs=$Connexion->fobject(); /* Complétion de l'authentification */ $auth->setValue("rezo_user",$rs->login); $auth->setValue("rezo_mdp",$rs->password); $auth->setValue("rezo_path",$rs->path); $auth->setValue("rezo_schema",$rs->schema); /* Sauvegarde dans la session du schema */ //if(!session_is_registered("rezo_schema")) //{ $_SESSION['rezo_schema'] = $auth->getValue("rezo_schema"); //} /* */ $Connexion->exec("SELECT * FROM appli.GetInfoFromThisRezoSchemaPath('".$auth->getValue("rezo_schema")."')"); $Virtual_nom_fichier = array(); $Virtual_nom_table = array(); $Virtual_date_de_derniere_importation = array(); $Connexion->setRow(-1); if ($Connexion->numRows()==0) { $Virtual_nom_fichier[] = 'JLKJL9090'; $Virtual_nom_table[] = 'JLKJL9090'; $Virtual_date_de_derniere_importation[] = 'JLKJL9090'; } else { while($Connexion->nextRow()) { $rs=$Connexion->fobject(); $Virtual_nom_fichier[] = $rs->nom_fichier; $Virtual_nom_table[] = $rs->nom_table; $Virtual_date_de_derniere_importation[] = $rs->date_de_derniere_importation; } } /* Si on arrive jusqu'ici alors 1) Connexion à l'appli = OK 2) Connexion au réseau = OK Donc plusieurs précautions sont à prendre: 1) le répertoire en question existe? 2) le répertoire est-il vide? 3) y'a des fichiers GeoSpatiale avec les fichiers auxilaires voulus? Si on passe tous ces tests alors on affiche le tableau si le tableau est vide par défaut on propose le nom du fichier (filtré comme il faut) comme nom de table associée si un fichier géospatiale est nouveau (donc il n'est pas encore référencé */ $obj_rezo = new GeoDataRep($auth->getValue("rezo_path"));echo $auth->getValue("rezo_path"); $obj_rezo->ListEveryIn(); if ( $obj_rezo->IsValidGeoDataRep()==_IS_A_VALID_DIR_ )// on vérifie que le répertoire existe! {//Début validation 1: Oui le répertoire existe if ( $obj_rezo->IsAEmptyRep()==_IS_A_EMPTY_DIR )// le répertoire n'est pas vide! {//Début validation 2: Non le répertoire n'est pas vide! if ( $obj_rezo->ThereIsGeoSpatialesFiles() ) {//Erreur validation 3 for($iter=0;$iter<$obj_rezo->CountEvery();$iter++) { $TestOnFile = $obj_rezo->IsAValidGisFile($iter); if ($TestOnFile[0]==true) {$GoodFiles++;} } ?>
 Options Cocher  Mettre en Lambert II Etendu  Mettre en Lambert III
Décocher  Mettre sans système de projection
\n"; echo "\n"; echo "\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\n"; $iter=0;// indice pour les bons fichiers $itertest=0;// indice de test pour les fichiers $Maxiter = $obj_rezo->CountEvery(); while($itertest<$obj_rezo->CountEvery()) { // // Il faut vérifier si le fichier en question est présent avec les divers autres // fichiers attendus. Exemple pour shapefile: il faut les fichiers shx et dbf // // Pour chaque fichier (.shp ou .tab), on doit commencer par déterminer // le type afin de pouvoir afficher l'icône correspondant // $TestOnFile = $obj_rezo->IsAValidGisFile($itertest); // $TestOnFile[0]=> renvoit true ou false s'il y a une erreur ou pas // $TestOnFile[1] => Erreur trouvée! // $nom_table_en_cours = $obj_rezo->Filter($itertest); // // On vérifie ici le fichier est déjà référencé dans la table t_fichier_src // Si oui, si on la choisit il faut pouvoir l'effacer // if (in_array($nom_table_en_cours,$Virtual_nom_table)) {// oui c'est une table qui est déjà référencée! $color_tr = "#e7dfce"; $input_drop_table = "1"; $input_drop_table_name = $nom_table_en_cours; $effet_javascript_for_check = "onclick=\"ChangerStatusTableChoisie('".$iter."')\""; $input_type_hidden_drop_table = " \n"; } else {// non cette table n'a pas encore été référencée, elle est nouvelle! $color_tr = "#ee6500"; $input_drop_table = "0"; $input_drop_table_name = " "; $effet_javascript_for_check = " "; $input_type_hidden_drop_table = " "; } echo "\n"; $icon_type = ((($obj_rezo->GetExtensionType($itertest)== "SHP")||($obj_rezo->GetExtensionType($itertest)== "shp"))? "shapefile.png":"mapinfo.png"); if ($TestOnFile[0]==false) { echo "\n"; echo ""; $nom_table = "XXX"; $olditer = $iter; $iter = "XXX"; } else { echo "\n"; echo "\n"; } echo "\n"; if ($TestOnFile[0]==true) { echo "\n \n"; } else { echo "<\n"; } echo ""; if ($TestOnFile[0]==false) { $iter = $olditer;$iter; } else{$iter++;} $itertest++; } echo "
\nValidation\t\t\nChoix\t\t\nN°\t\t\nType\t\t\nNom du fichier\t\t\nNom de la table\t\t\nProjection\t\t
ERREUR: "; echo "
    "; for($ItError=0;$ItError".utf8_decode($TestOnFile[1][$ItError])."";} echo "
"; echo "
".$iter." ".$input_type_hidden_drop_table." ".$obj_rezo->GetFileNameWithOutExt($itertest)." \n \n"; /* if ($etat_db==0) { echo ">>\n Nouvelle table"; }*/ echo "\n\n"; /* if ($etat_db==0) { echo "
>> ".utf8_decode("Mise à jour d'une table").""; echo "\n"; }*/ echo "
XXXXXX
\n"; }//Erreur validation else {//Début validation 3 echo "Le répertoire n'est pas vide! Mais aucun fichier géospatiale n'a été trouvé, du type ESRI Shapfile (.shp), MapInfo (.map,mif/mid)"; exit(""); }// Fin validation 3 }// Fin Validation 2 else {//Erreur sur validation 2: Oui le répertoire est vide echo "le répertoire en question existe mais est vide!"; exit(""); }//Erreur sur validation 2 }// Fin Validation 1 else // le path spécifié n'existe pas! {//Erreur sur validation 1: Non le répertoire n'existe pas! echo "le répertoire attendu n'existe pas!"; exit(""); }//Erreur sur validation 1 }// Fin du Script général! ?>