Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
1 résultat Searching

bot.ts

Blame
  • index.php 4,63 Kio
    <script>
    
        
        if(typeof window.history.pushState == 'function') {
            window.history.pushState({}, "Hide", '<?php echo $_SERVER['PHP_SELF'];?>');
        }
    
    </script>
    
    <?php
    
    /*************************************************
     * 
     *   0) Récupérer les tâches du fichier de données
     * 
     * **********************************************/
    
    $tachesFichier = "data/memo.json";
    $tachesJSON = file_get_contents($tachesFichier);
    
    
    $tachesArray = json_decode($tachesJSON, true);
    $tachesFilter = $tachesArray;
    
    
     
    
    /***********************
     *
     *  1) Ajouter une tâche
     * 
     * ********************/
    
    
    
    if (isset($_POST["texteTache"])) {
        $texte = $_POST["texteTache"];
    
        
        $idTache = uniqid();
        
    
        
        $dateHeureTache = gmdate('Y-m-d\TH:i:s.v\Z');
       
    
        
        
        $tachesArray[$idTache] = [
            "texte" => $texte,
            "accomplie" => false,
            "dateAjout" => $dateHeureTache,
        ];
    
        
    
        
        $tachesJSON = json_encode($tachesArray);
    
        
        file_put_contents($tachesFichier, $tachesJSON);
    }
    
    
    /*************************************************************
     *
     *  2) Afficher les tâches : Voir ci-dessous dans le code HTML
     * 
     * **********************************************************/