File "FTP02.php"

Full Path: /home/analogde/www/Massage_v3_debug/MASSAGE_TEST/FTP/FTP02.php
File size: 4.57 KB
MIME-type: text/html
Charset: utf-8

<!DOCTYPE html>
<html>
<body>

<link rel="stylesheet" href="//code.jquery.com/ui/1.13.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://code.jquery.com/ui/1.13.1/jquery-ui.js"></script>

<script>

function fct_remove(filename)
{
		alert("Pipo");
	
		var folder = "uploaded_files";

		$(function () 
		{
			$( "#dialog" ).dialog({
								modal: true,
								title: "Info",
								closeOnEscape: false,
								buttons: {
											Oui: function()
											{
												$( this ).dialog( "close" );
												window.location.href = "remove.php?filename=" + filename + "&folder=" + folder;
											},
											Non: function()
											{
												$( this ).dialog( "close" );
													
											}
										 }
			});
			
			$("#action").click(function () 
			{
				$('#dialog').dialog('open');
			});
		});
	
}

</script>

</script>

<br><br>

<form action="pipo04.php" method="post" enctype="multipart/form-data">
  Select file to upload:
  <input type="file" name="fileToUpload" id="fileToUpload">
  <input type="submit" value="Upload" name="submit">
</form>

</body>
</html>

<?php

	echo "<br><br>";

	echo '<div id="dialog" style="display: none" align = "center">Confirmation suppresion ?.</div>';

	$path = "uploaded_files";
	$listing_array = array();
	$cpt = 0;
	
	chdir($path);
	array_multisort(array_map('filemtime', ($files = glob("*.*"))), SORT_DESC, $files);
	foreach($files as $filename)
	{
		//echo "<li>".substr($filename, 0, -4)."</li>";
		//echo "<li>" .$filename    ."</li>";
		
		if(is_file($filename))
		{
			$listing_array[$cpt][0] = $filename;
			$listing_array[$cpt][1]= filesize($filename);
			$listing_array[$cpt][2]= filemtime($filename);
			$listing_array[$cpt][3]= date("F d Y H:i:s", filemtime($filename));
			$cpt = $cpt + 1;
		}
	}
	
	echo "<table border=1 cellpadding=5 cellspacing=0>";
	echo "	<tr>
			<th>Id</th>
			<th>Fichier</th>
			<th>Date</th>
			<th>Taille en octets</th>
			<th>Importer</th>
			<th>Supprimer</th>
			</tr>";
			
	//for($i=0; $i < count($tab_affiche); $i++)
	for($i=0; $i < $cpt; $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 $listing_array[$i][0];
			
			//echo '</a>
			echo	'</td>';
			
			$b = '<input type="button" value="Voir">';
			
			
			echo "<td align = 'center'>" .$listing_array[$i][3] ."</td>";
			
			
			echo "<td align = 'center'>" .$listing_array[$i][1] ."</td>";
			
			
			
			$blabla = $listing_array[$i][0];

			
			
			//echo "<td align = 'center'>"; 
			//echo "<button type=\"button\" title=\"Visualiser\" id=\"button_voir\" onclick=\"window.location.href='https://analog-design.net/CHESS_2022/visualiser.php?filename=$blabla'\"> Voir </>";
			//echo "<button type=\"button\" title=\"Visualiser\" id=\"button_voir\" onclick=\"window.location.href='https://analog-design.net/CHESS_2022/visualiser.php?filename=$blabla&folder=backup'\"> Voir </>";
			//echo "</td>";
			
			//echo "<td align = 'center'>"; 
			//echo "<button type=\"button\" title=\"Editer\" id=\"button_editer\" onclick=\"window.location.href='https://analog-design.net/CHESS_2022/editer.php?filename=$blabla'\"> Modifier </>";
			//echo "</td>";
			
			//echo "<td align = 'center'>"; 
			//echo "<button type=\"button\" title=\"Copie\" id=\"button_copier\" onclick=\"fct('$blabla')\"> Copier </>";
			//echo "</td>";
		
	
			//echo "<td align = 'center'>"; 
			//echo "<button type=\"button\" title=\"Importer\" id=\"button_importer\" onclick=\"window.location.href='https://analog-design.net/CHESS_2022/importer.php?filename=$blabla&folder=backup'\"> Importer </>";
			//echo "</td>";
			
			echo "<td align = 'center'>"; 
			//echo "<button type=\"button\" title=\"Impoter\" id=\"button_importer\" onclick=\"fct_importer('$blabla')\"> Importer </>";
			echo "<a href=/FTP/uploaded_files/" .$blabla ." download=" .$blabla ."> <button type='button'>Go</button></a>";
			echo "</td>";
			

			echo "<td align = 'center'>"; 
			echo "<button type=\"button\" title=\"Supprimer\" id=\"button_remove\" onclick=\"fct_remove('$blabla')\"> Trash </>";
			echo "</td>";

			
			
			echo '</td>
			      </tr>';
	}
	echo "</table>";

?>