Jump to content

psytanium

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Posts posted by psytanium

  1. hey everyone, its my first topic here, and i'm at a beginner level with php, so excuse my poor level :)

    well, i have a problem trying to add a delete button or link next to each file in query so the user can delete the file. and that's the code i'm using in my page:

    <?php
      include ("functions.php");
    include ("header.php"); 
    // Settings section ------------------------------
    
    $co_filedir = "../conseiller/files/"; 				// The file folder
    $columns = 1; 				        // Number of columns of files listed per row
    $tablewidth = 800;                              // Table Width
    $namecolumn = ($tablewidth / $columns) / 2;     // File Name Column Width
    $datecolumn = $namecolumn / 2;                  // Date column width
    $sizecolumn = $datecolumn;                      // File Size Column width
    global $co_filename;
    global $co_filename_sorted;
    
    $coi=0;
    $coj=0;
    $cok=0;
    $com=0;
    
    if(isset($_GET['st']))
    {
      $st = $_GET['st'];
    }
    else
    {
      $st = 1;
    }
    
    if(isset($_GET['order']))
    {
      $order = "SORT_".$_GET['order'];
    }
    else
    {
      $order = "SORT_ASC";
    }  
    
    // Table Title row -------------------------------
    
    echo "<table width=\"$tablewidth\" cellpadding=\"3\" cellspacing=\"1\"><tr>";
    
    while ($cok < $columns)
    {
    echo "<td bgcolor=#666 width=$namecolumn align=center><font color=#000000>";
    echo "    <table border=0 cellpadding=0 cellspacing=0>";
    echo "    <tr>";
    echo "        <td rowspan=2><a href=\"index.php?st=1\"><b>Nom de fichier</b><a/>  </td>";
    echo "        <td><a href=\"index.php?st=1&order=ASC\"><img src=\"images/arrow_up.gif\" border=0></a></td>";
    echo "    </tr>";
    echo "    <tr>";
    echo "        <td><a href=\"index.php?st=1&order=DESC\"><img src=\"images/arrow_down.gif\" border=0></a></td>";
    echo "    </tr>";
    echo "    </table></font>";
    echo "</td>\n";
    echo "<td bgcolor=#666 width=$datecolumn align=center><font color=#000000>";
    echo "    <table border=0 cellpadding=0 cellspacing=0>";
    echo "    <tr>";
    echo "        <td rowspan=2><a href=\"index.php?st=2\"><b>Date du fichier</b><a/>  </td>";
    echo "        <td><a href=\"index.php?st=2&order=ASC\"><img src=\"images/arrow_up.gif\" border=0></a></td>";
    echo "    </tr>";
    echo "    <tr>";
    echo "        <td><a href=\"index.php?st=2&order=DESC\"><img src=\"images/arrow_down.gif\" border=0></a></td>";
    echo "    </tr>";
    echo "    </table></font>";
    echo "</td>\n";
    echo "<td bgcolor=#666 width=$sizecolumn align=center><font color=#000000>";
    echo "    <table border=0 cellpadding=0 cellspacing=0>";
    echo "    <tr>";
    echo "        <td rowspan=2><a href=\"index.php?st=3\"><b>Taille du fichier</b><a/>  </td>";
    echo "        <td><a href=\"index.php?st=3&order=ASC\"><img src=\"images/arrow_up.gif\" border=0></a></td>";
    echo "    </tr>";
    echo "    <tr>";
    echo "        <td><a href=\"index.php?st=3&order=DESC\"><img src=\"images/arrow_down.gif\" border=0></a></td>";
    echo "    </tr>";
    echo "    </table></font>";
    echo "</td>\n";
    
    $cok++;
    }
    
    echo "</tr>";
    
    $handle = opendir($co_filedir); 
    
    while (false !==($file = readdir($handle)))
    { 
        if ($file != "." && $file != "..") 
        {
    //$co_filename[$coi][1] = $file;
            //$co_filename[$coi][2] = date ("m/d/y", filemtime($co_filedir.$file));
            //$co_filename[$coi][3] = round(filesize($co_filedir.$file)/1024);
            $co_filename[$coi][1] = $file;
            $co_filename[$coi][2] = filemtime($co_filedir.$file); //date ("m/d/y", filemtime($co_filedir.$file));
            $co_filename[$coi][3] = round(filesize($co_filedir.$file)/1024);
    ++$coi;
        }
    }
    
    closedir($handle);
    
    // Sorting --------------------------------------------
    
    $co_filename_sorted = csort($co_filename, $order, $st);
    
    // End of Sorting -------------------------------------
    
    while($com<(count($co_filename)))
    {
    echo "<tr class=list>";
    echo "<td width=$namecolumn><a href=\"$co_filedir".$co_filename_sorted[$com][1]."\"><font color=#333>".$co_filename_sorted[$com][1]."<font></a><br></td>\n";
            echo "<td width=$datecolumn align=center><font color=#333>";
    echo date("m/d/y",$co_filename_sorted[$com][2])."</font></td>";
            echo "<td width=$sizecolumn  align=right><font color=#333>";
    echo $co_filename_sorted[$com][3]." KB ";
            echo "</font></td>";
    ++$coj;
      	if($coj == $columns)
    
    	{ 
    
      		$coj = 0;
      	}
    $com++;
    }
    echo "</tr><tr>";
    echo "</tr></table>";
    echo "Il ya actuellement <b>".$coi."</b> fichiers dans le répertoire.<br>";
    ?>

     

     

    well, ill be more than glad if someone could help done this issue.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.