diff --git a/README.md b/README.md
index d8a5110..0bf228e 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,11 @@ Securite acces
---------------
via .htaccess .htpasswd
-URL
+URL TEST
---------------
https://devod.digitalorigin.fr/
-pwd:toto2018
\ No newline at end of file
+pwd:toto2018
+
+update md5 :
+---------------
+action.php?action=update_checkmd5
\ No newline at end of file
diff --git a/action.php b/action.php
index 232a745..f6c13eb 100644
--- a/action.php
+++ b/action.php
@@ -78,8 +78,17 @@ if ($action=='load')
unset($getData[10]);
unset($getData[12]);
;
- //var_dump($getData);
- //exit();
+ $getData[0]=trim($getData[0]);
+ $getData[2]=trim($getData[2]);
+ $getData[3]=trim($getData[3]);
+ $getData[4]=trim($getData[4]);
+ $getData[6]=trim($getData[6]);
+ $getData[7]=trim($getData[7]);
+ $getData[8]=trim($getData[8]);
+ $getData[11]=trim($getData[11]);
+ //echo(serialize($getData));
+ //echo '
';
+ //exit;
$checkmd5=hash('md5',serialize($getData));
// Get row data
@@ -88,7 +97,7 @@ if ($action=='load')
$dmy=explode('/',$date_piece);
$date_piece=$dmy[2].'-'.$dmy[1].'-'.$dmy[0];
$no_compte = $getData[0];
- $lib_compte = $getData[1];
+ //$lib_compte = $getData[1];
$No_piece = $getData[3];
#$lib_mouvement = $getData[6];
$lib_mouvement = iconv( mb_detect_encoding($getData[6]), 'Windows-1252//TRANSLIT', $getData[6]);
@@ -124,7 +133,8 @@ if ($action=='load')
$check = mysqli_query($conn, $query);
$row = mysqli_fetch_row($check);
$num = $row[0];
- //$num=0;
+
+
if ($num==0)
{
@@ -242,36 +252,58 @@ elseif ($action=='update_checkmd5')
$query="ALTER TABLE importation_data_aidimpact ADD idt int not null auto_increment primary key AFTER checkmd5;";
//$query="SELECT idt,md5(concat(IFNULL(no_compte,''),IFNULL(code_JNL,''),IFNULL(No_piece,''),IFNULL(date_piece,''),IFNULL(lib_mouvement,''),IFNULL(debit,''),IFNULL(credit,''),IFNULL(code_activite,''))) as checkmd5 from importation_data_aidimpact;";
- $query="SELECT idt,no_compte,code_JNL,No_piece,date_piece,lib_mouvement,debit,credit,code_activite from importation_data_aidimpact;";
+ $query="SELECT idt,no_compte,code_JNL,No_piece,DATE_FORMAT(date_piece,'%d/%m/%Y')as date_piece,lib_mouvement,IFNULL(debit,'') as debit,IFNULL(credit,'') as credit,code_activite from importation_data_aidimpact;";
$result=mysqli_query($conn, $query);
$data = array();
if (mysqli_num_rows($result) > 0) {
+
+
while ($row = mysqli_fetch_assoc($result)) {
- $row2 = $row;
- unset($row2["idt"]);
-
+ //$row2=$row;
+ $row2=array();
+ $row2[0]=trim($row["no_compte"]);
+ $row2[2]=trim($row["code_JNL"]);
+ $row2[3]=trim($row["No_piece"]);
+ $row2[4]=trim($row["date_piece"]);
+ $row2[6]=trim($row["lib_mouvement"]);
+ $row2[7]=trim($row["debit"]);
+ $row2[8]=trim($row["credit"]);
+ $row2[11]=trim($row["code_activite"]);
+
+
+ //echo(serialize($row2));
+ //echo '
';
$checkmd5=hash('md5',serialize($row2));
$query="update importation_data_aidimpact set checkmd5='".$checkmd5."' where idt=".$row["idt"].";";
- $result=mysqli_query($conn, $query);
+ $result2=mysqli_query($conn, $query);
+
}
+
}
-$query="select idt,checkmd5 from importation_data_aidimpact";
-//$query="select no_compte,CONCAT(no_compte,lib_compte,code_JNL,No_piece,date_piece,lib_mouvement,debit,credit,code_activite) as checkmd5 from importation_data_aidimpact";
-$result=mysqli_query($conn, $query);
-$data = array();
- if (mysqli_num_rows($result) > 0) {
- while ($row = mysqli_fetch_assoc($result)) {
- $data[] = $row;
+ $query="select idt,checkmd5 from importation_data_aidimpact";
+ //$query="select no_compte,CONCAT(no_compte,lib_compte,code_JNL,No_piece,date_piece,lib_mouvement,debit,credit,code_activite) as checkmd5 from importation_data_aidimpact";
+ $result=mysqli_query($conn, $query);
+ $data = array();
+ if (mysqli_num_rows($result) > 0) {
+ while ($row = mysqli_fetch_assoc($result)) {
+ $data[] = $row;
+ }
}
- }
- var_dump($data);
- echo "
update checkmd5 done !" ;
+
+ echo "
update checkmd5 done !" ;
+
+ $query="select count(checkmd5) as smd5 from importation_data_aidimpact group by checkmd5 having smd5>1";
+
+ $res=mysqli_query($conn, $query);
+ $num=mysqli_num_rows($res);
+ echo '
'.$num;
+
}
else
{