1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| if(isset($_POST['geo'])) {
$i='1';
$repertoireDestination = "upload/";
$nomDestination = $_FILES["monfichier"]["name"];
// Pour raison de sécurité nous ajouterons aux fichiers
// portant une extension .php .php3, l'extension .txt
if (eregi(".php", $nomDestination)) {
$nomDestination .= ".txt";
}
if (is_uploaded_file($_FILES["monfichier"]["tmp_name"])) {
if (copy($_FILES["monfichier"]["tmp_name"],
$repertoireDestination.$nomDestination)) {
$row = 1;
$handle = fopen("upload/localisation.csv", "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
$row++;
for ($c=0; $c < $num; $c++) {
echo "$data[0]<br/>";
list($champ1, $champ2, $champ3, $champ4, $champ5, $champ6, $champ7, $champ8) = explode(';',$data[$c]);
for($piece = strtok($champ1, ",");
$piece != "";
$piece = strtok(","))
for($piece2 = strtok($champ2, ",");
$piece2 != "";
$piece2 = strtok(","))
$champ1=addslashes(utf8_encode($champ1));
$champ6=addslashes(utf8_encode($champ6));
$champ3=addslashes(utf8_encode($champ3));
$champ4=addslashes(utf8_encode($champ4));
$Text=$champ6;
$Nouvelle="";
for ($i = 0; $i < strlen($Text); $i++) {
if (substr($Text, $i,1) != ' ')
{
$Nouvelle=$Nouvelle . substr($Text, $i,1);
}
}
$Text=$champ7;
$Nouvelle2="";
for ($i = 0; $i < strlen($Text); $i++) {
if (substr($Text, $i,1) != ' ')
{
$Nouvelle2=$Nouvelle2 . substr($Text, $i,1);
}
} |
Partager