stany.ferer 1 rok temu
rodzic
commit
4ecd24c76f

+ 8 - 0
core/submit/cms.compte-upload.php

@@ -25,6 +25,14 @@ if (core::ifPost("from") AND core::getPost("from") == "compte-upload") {
     } else {
 
         if (file_exists($_FILES[core::getPost("from")]['tmp_name'])) {
+
+            $tmpFile = explode(" ", core::getPost("compte"));
+            if(strpos(core::getFiles(core::getPost("from"))['name'], $tmpFile[1].$tmpFile[2]) === FALSE){
+                alert::recError("Ce CSV " . $_FILES[core::getPost("from")]['name'] . " n'est semble pas correspondre au bon fichier de compte.");
+                header("Location: /?p=compte-upload&add=".core::getPost("add"));
+                exit();
+            }
+
             $csvValue = banque::readCompte($_FILES[core::getPost("from")]);
 
             if($csvValue == FALSE){

+ 3 - 1
core/views/pages/cms.compte-upload.php

@@ -20,10 +20,12 @@
 <form action="/submit.php" method="post" enctype="multipart/form-data" onsubmit="loading()">
     <input type="hidden" name="from" value="compte-upload">
     <input type="hidden" name="add" value="<?php echo core::getGet("add") ?>">
+    <input type="hidden" name="compte" value="<?php echo $banque["compte"] ?>">
+
     <div class="file-drop-area">
         <span class="choose-file-button">Choisissez votre fichier CSV</span>
         <span class="file-message">ou déposez le dans cette zone</span>
-        <input id="compte-upload" class="import-excel" name="compte-upload" type="file" onchange="dargAndDrop()" accept=".csv">
+        <input id="compte-upload" class="import-excel" name="compte-upload" type="file" onchange="dargAndDrop()" accept=".csv" required>
     </div>
     <br />
     <?php button::confirm(