| |

 

>
"; if($csv_file['tmp_name'] != "") { $fp = @fopen($csv_file['tmp_name'], "r"); if(!$fp) { echo $vocab["admin_import_users_csv4"]; } else { $row = 0; echo ""; $valid = 1; while(!feof($fp)) { if ($en_tete == 'yes') { $data = fgetcsv ($fp, $long_max, ";"); $en_tete = 'no'; } $data = fgetcsv ($fp, $long_max, ";"); $num = count ($data); if ($num == 5) { $row++; echo ""; for ($c=0; $c<$num; $c++) { switch ($c) { case 0: //login if (ereg ("^[a-zA-Z0-9_.]{1,20}$", $data[$c])) { $data[$c] = strtoupper($data[$c]); $test = sql_count(sql_query("SELECT login FROM grr_utilisateurs WHERE login='$data[$c]'")); if ($test!='0') { echo ""; echo ""; $test_login_existant = "oui"; $login_exist = "oui"; $login_valeur = $data[$c]; } else { echo ""; echo ""; $login_exist = "non"; } $data_login = htmlentities($data[$c]); echo ""; } else { echo ""; $valid = 0; } break; case 1: //Nom $test_nom_prenom_existant = 'no'; if (ereg ("^.{1,30}$", $data[$c])) { $test_nom = slashes($data[$c]); $test_prenom = slashes($data[$c+1]); $test_nom_prenom = sql_count(sql_query("SELECT nom FROM grr_utilisateurs WHERE (nom='$test_nom' and prenom = '$test_prenom')")); if ($test_nom_prenom!='0') { $test_nom_prenom_existant = 'yes'; echo ""; } else { echo ""; } $data_nom = htmlentities($data[$c]); echo ""; } else { echo ""; } break; case 2: //Prenom if (ereg ("^.{1,30}$", $data[$c])) { if ($test_nom_prenom_existant == 'yes') { echo ""; } else { echo ""; } $data_prenom = htmlentities($data[$c]); echo ""; } else { echo ""; $valid = 0; } break; case 3: // Mot de passe if (ereg ("^.{".$pass_leng.",30}$", $data[$c])) { $data_mdp = htmlentities($data[$c]); echo ""; echo ""; } else { echo ""; $valid = 0; } break; case 4: // Adresse E-mail if ((ereg ("^.{1,100}$", $data[$c])) or ($data[$c]=='')){ $data_email = htmlentities($data[$c]); echo ""; echo ""; } else if ($data[$c]=='-') { echo ""; echo ""; } else { echo ""; $valid = 0; } break; } } echo ""; } } fclose($fp); echo "

".$vocab["login"]."

".$vocab["name"]."

".$vocab["first_name"]."

".$vocab["pwd"]."

".$vocab["email"]."

$data[$c]

$data[$c]

???

$data[$c]

$data[$c]

???

$data[$c]

$data[$c]

???

$data[$c]

???

$data[$c] 

??????
"; echo "

".$vocab["admin_import_users_csv5"]."$row ".$vocab["admin_import_users_csv6"]."

"; if ($row > 0) { if ($test_login_existant == "oui") { echo $vocab["admin_import_users_csv7"]; } if ($test_nom_prenom_existant == 'yes') { echo $vocab["admin_import_users_csv8"]; } if ($valid == '1') { echo ""; echo ""; echo ""; echo ""; } else { echo $vocab["admin_import_users_csv9"]; echo ""; } } else { echo "

".$vocab["admin_import_users_csv10"]."

"; } } } else { echo "

".$vocab["admin_import_users_csv11"]."

"; } } } else { // Phase d'enregistrement des données $nb_row = isset($_POST["nb_row"]) ? $_POST["nb_row"] : NULL; $reg_stat = isset($_POST["reg_stat"]) ? $_POST["reg_stat"] : NULL; $reg_login = isset($_POST["reg_login"]) ? $_POST["reg_login"] : NULL; $reg_nom = isset($_POST["reg_nom"]) ? $_POST["reg_nom"] : NULL; $reg_prenom = isset($_POST["reg_prenom"]) ? $_POST["reg_prenom"] : NULL; $reg_email = isset($_POST["reg_email"]) ? $_POST["reg_email"] : NULL; $reg_mdp = isset($_POST["reg_mdp"]) ? $_POST["reg_mdp"] : NULL; $nb_row++; for ($row=1; $row<$nb_row; $row++) { $reg_mdp[$row] = md5(unslashes($reg_mdp[$row])); // On nettoie les windozeries $reg_nom[$row] = corriger_caracteres($reg_nom[$row]); $reg_prenom[$row] = corriger_caracteres($reg_prenom[$row]); $reg_email[$row] = corriger_caracteres($reg_email[$row]); $test_login = sql_count(sql_query("SELECT login FROM grr_utilisateurs WHERE login='$reg_login[$row]'")); if ($test_login == 0) { $regdata = sql_query("INSERT INTO grr_utilisateurs SET nom='".$reg_nom[$row]."',prenom='".$reg_prenom[$row]."',login='".$reg_login[$row]."',email='".$reg_email[$row]."',password='".slashes($reg_mdp[$row])."',statut='utilisateur',etat='actif',source='local'"); } else { $regdata = sql_query("UPDATE grr_utilisateurs SET nom='".$reg_nom[$row]."',prenom='".$reg_prenom[$row]."',email='".$reg_email[$row]."',password='".slashes($reg_mdp[$row])."',statut='utilisateur',etat='actif',source='local' WHERE login='".$reg_login[$row]."'"); } if (!$regdata) { echo "

".$reg_login[$row]." : ".$vocab["message_records_error"]."

"; } else { if ($reg_stat[$row] == "nouveau") { echo "

".$reg_login[$row]." : ".$vocab["admin_import_users_csv12"]."

"; } else { echo "

".$reg_login[$row]." : ".$vocab["message_records"]."

"; } } } } ?>