Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
DCIM
/
Auto
/
CHESS_2022
:
read.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php header( 'content-type: text/html; charset=utf-8' ); error_reporting(0); date_default_timezone_set('Europe/Paris'); //$filename = 'abc.csv'; //$f = fopen($filename, 'r'); //if ($f) //{ // $contents = fread($f, filesize($filename)); // fclose($f); // echo nl2br($contents); //} $path = "backup"; $files = array_diff(scandir($path), array('.', '..')); $results = array(); $cpt = 0; foreach($files as $file) { if (!in_array($file,array(".",".."))) { //echo $file ." " .filesize('backup/'.$file) . ' bytes'; //echo"<br />"; $results[$cpt][0] = $file; $results[$cpt][1]= filesize('backup/'.$file); $results[$cpt][2]= filemtime('backup/'.$file); $results[$cpt][3]= date("F d Y H:i:s.", filemtime('backup/'.$file)); $cpt = $cpt + 1; //echo "Content last changed: ".date("F d Y H:i:s.", filemtime('backup/'.$file)); //echo "Content last changed: " .filemtime('backup/'.$file); //$date_pieces = explode("-",$file_name[0]); //$jour = $date_pieces[1]; //$mois = $date_pieces[2]; //$annee = $date_pieces[3]; //$heure_tab = explode("_",$date_pieces[4]); //echo "<pre>"; //print_r($date_pieces); //$timestamp = mktime ($heure_tab[0], $heure_tab[1], $heure_tab[2], $mois, $jour, $annee); } } echo "<pre>"; print_r($results); echo "</pre>"; $tab = listing_fichier_repertoire('backup'); for($i=0; $i < count($tab); $i++) { $tab_fichier = $tab[$i][0]; $tab_ts[] = $tab[$i][1]; } $tab_sort = $tab_ts; sort($tab_sort); $tab_reverse = array_reverse($tab_sort); for($i=0; $i < count($tab); $i++) { $element = $tab_reverse[$i]; $position = array_search($element, $tab_ts); //echo '<br><br>'; $file = $tab[$position][0]; //echo $position ." " .$tab[$position][0] ." " .filesize($file); $tab_affiche[$i][0] = $tab[$position][0]; $tab_affiche[$i][1] = filesize($file); } //echo '<textarea id="html_content" style="width:600;height:200;resize:none" readonly >' .$contents .'</textarea>'; echo "<table border=1 cellpadding=5 cellspacing=0>"; echo " <tr> <th>Id</th> <th>Fichier backup</th> <th>Taille en octets</th> <th>Voir</th> <th>Charger</th> </tr>"; //?Prenom=Christophe $blabla = "aaa.txt"; // <a href=\"visualise.php?filename=$blabla\" title='Statistiques'>".$joueur."</a> // <a href=\"visualise.php?filename=$blabla\" title='Statistiques'></a> for($i=0; $i < count($tab_affiche); $i++) { $j = $i + 1; echo "<tr> <td>" .$j ."</td>"; //echo '<td>'; //echo '<a href="restauration.php?fichier=" .$tab_affiche[$i][0].</a>' .$tab_affiche[$i][0] .'</td>'; echo '<td>'; //<a href="restauration.php?fichier='.$tab_affiche[$i][0].'" title = "Restauration">'; //echo $tab_affiche[$i][0]; echo $results[$i][0]; //echo '</a> echo '</td>'; $b = '<input type="button" value="Voir">'; //echo "<td align = 'center'>" .$tab_affiche[$i][1] ."</td>"; echo "<td align = 'center'>" .$results[$i][1] ."</td>"; //echo "<td align = 'center'>" .$b ."</td>"; //echo "<td align = 'center'> <a href=\"visualise.php?filename=$blabla\" title='Visualiser'>Voir</a></td>"; $blabla = $tab_affiche[$i][0]; $blabla = $results[$i][0]; //echo "<td align = 'center'> <a href=\"visualise.php?filename=$blabla\" title='Visualiser'>Voir</a></td>"; echo "<td align = 'center'>"; echo "<button type=\"button\" title=\"Visualiser\" id=\"buttonNext\" onclick=\"window.location.href='https://analog-design.net/CHESS_2022/visualise.php?filename=$blabla'\"> Voir </>"; echo "</td>"; //echo "<td align = 'center'> </td>"; //<button onclick="window.location.href = '\"visualise.php?filename=$blabla\';"> Visualiser </button> $element = ""; //echo "<td align = 'center'>" .$element ."</td>"; echo "<td align = 'center'>"; echo "<button type=\"button\" title=\"Editer\" id=\"buttonNext\" onclick=\"window.location.href='https://analog-design.net/CHESS_2022/editer.php?filename=$blabla'\"> Modifier </>"; echo "</td>"; echo '</td> </tr>'; } echo "</table>"; echo "<br><br>"; $dir = getcwd(); echo "<br><br>"; $chemin = getcwd(); echo '<br><br>'; $chemin = $dir ."/visualise.php"; echo $chemin; echo "<br><br>"; echo "<br><br>"; echo "<br><br>"; // echo '<button onclick="window.location.href = lulu.php"> Cliquez ici </button>'; //echo "<button type=\"button\" id=\"buttonNext\" onclick=\"window.location.href='http://visualise.php?filename=$blabla'\" />"; echo "<button type=\"button\" id=\"buttonNext\" onclick=\"window.location.href='https://analog-design.net/CHESS_2022/visualise.php?filename=$blabla'\">toto</>"; /// $chemin = '/homez.65/analogde/www/WORKAREA/WEBSITE/PROD/pipo'; // /home/analogde/www/CHESS_2022/visualise.php ?> <!-- <button onclick="window.location.href = 'https://waytolearnx.com';"> Cliquez ici </button> --> <?php function listing_fichier_repertoire($repertoire) { $results = array(); $handler = opendir($repertoire); $cpt = 0; $ts_actuel = strtotime(date("d-m-Y H:i:s")); //sauvegarde_edition-13-09-2015-10_06_57.txt while ($file = readdir($handler)) { if($file != "." && $file != ".." ) { $file_name = explode(".",$file); $date_pieces = explode("-",$file_name[0]); $jour = $date_pieces[1]; $mois = $date_pieces[2]; $annee = $date_pieces[3]; $heure_tab = explode("_",$date_pieces[4]); //echo "<pre>"; //print_r($date_pieces); $timestamp = mktime ($heure_tab[0], $heure_tab[1], $heure_tab[2], $mois, $jour, $annee); $ts_difference = $ts_actuel - $timestamp; $ts_7jours = 7 * 24 * 3600; if($ts_difference >= $ts_7jours) { //echo $file ." ---- " .$format ." " .$ts ." trop ancien" ; //chdir("sauvegarde_echec"); //unlink($file); $coco = 5; } $results[$cpt][0] = $file; $results[$cpt][1]= $timestamp; $results[$cpt][2]= filesize($file); $cpt = $cpt + 1; } } chdir("backup"); closedir($handler); return $results; } ?>