Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Skrypt na datę dodania pliku
Forum PHP.pl > Forum > Gotowe rozwiązania > Szukam
niki12345
Witam otoz mam swoj upload na forum ale chcialbym do downloadu dorzucic coś takiego jak: Data dodania pliku. Mógłby ktoś podać gotowy skrypt byłbym bardzo wdzięczny
MateuszS
$data = date();

i dodajesz do tabeli w bazie rekord.
Pawel_W
do tego jest funkcja filemtime()" title="Zobacz w manualu PHP" target="_manual
niki12345
mam takie pytanie pomoglby mi ktos wpiac ten skrypt na date do calego uploadu? Bo z PHP to dopiero poczatki moje POZDRO
skowron-line
Cytat(niki12345 @ 18.07.2009, 21:31:40 ) *
mam takie pytanie pomoglby mi ktos wpiac ten skrypt na date do calego uploadu? Bo z PHP to dopiero poczatki moje POZDRO

To pokaż kod to Ci wskazemy gdzie wstawić kod.
niki12345
  1. # header & title of this file
  2. $title = "UPLOAD ";
  3.  
  4. # individual file size limit - in bytes (102400 bytes = 100KB)
  5. $file_size_ind = "10240000";
  6.  
  7. # the upload store directory (chmod 777)
  8. $dir_store= "store";
  9.  
  10. # the images directory
  11. $dir_img= "img";
  12.  
  13. # the style-sheet file to use (located in the "img" directory, excluding .css)
  14. $style = "style-def";
  15.  
  16. # the file type extensions allowed to be uploaded
  17. $file_ext_allow = array("txt","doc","zip","rar");
  18.  
  19. # option to display the file list
  20. # to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
  21. $file_list_allow = 1;
  22.  
  23. # option to allow file deletion
  24. # to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
  25. $file_del_allow = 0;
  26.  
  27. # option to password-protect this script [-part1]
  28. # to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
  29. $auth_ReqPass = 0;
  30.  
  31. # option to password-protect this script [-part2]
  32. # if "$auth_ReqPass" is enabled you must set the username and password
  33. $auth_usern = "login";
  34. $auth_passw = "haslo";
  35.  
  36. ################ end of configurations ###############
  37.  
  38.  
  39. # DO NOT ALTER OR EDIT BELOW THIS LINE UNLESS YOU ARE AN ADVANCED PHP PROGRAMMER
  40.  
  41. ?>
  42. <?
  43. if (@phpversion() < '4.1.0') {
  44.    $_FILE = $HTTP_POST_FILES;
  45.    $_GET = $HTTP_GET_VARS;
  46.    $_POST = $HTTP_POST_VARS;
  47. }
  48. error_reporting(E_ALL & ~E_NOTICE);
  49. $fum_vers = "1.3"; # do not edit this line, the script will not work!!!
  50. $fum_info_full = "File Upload Manager v$fum_vers";
  51.  
  52. function authDo($auth_userToCheck, $auth_passToCheck)
  53. {
  54.    global $auth_usern, $auth_passw;
  55.    $auth_encodedPass = md5($auth_passw);
  56.    
  57.    if ($auth_userToCheck == $auth_usern && $auth_passToCheck == $auth_encodedPass) {
  58.    $auth_check = TRUE;
  59.    } else {
  60.    $auth_check = FALSE;
  61.    }
  62.    return $auth_check;
  63.    }
  64.    
  65.    if (isset($logout)) {
  66.    setcookie ('fum_user', "",time()-3600);
  67.    setcookie ('fum_pass', "",time()-3600);
  68.    }
  69.        
  70.    if (isset($login)) {
  71.    $auth_password_en = md5($auth_formPass);
  72.    $auth_username_en = $auth_formUser;
  73.  
  74.    if (authDo($auth_username_en, $auth_password_en)) {
  75.    setcookie ('fum_user', $auth_username_en,time()+3600);
  76.    setcookie ('fum_pass', $auth_password_en,time()+3600);
  77.    $auth_msg = "<b>Authentication successful!</b> The cookies have been set.<br><br>".
  78.    $auth_msg . "Your password (MD5 encrypted) is: $auth_password_en";
  79.    } else {
  80.    $auth_msg = "<b>Authentication error!</b>";
  81.    }
  82. }
  83.  
  84. if (($_GET[act]=="dl")&&$_GET[file])
  85. {
  86.    if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && isset($fum_user) && !isset($logout))) {
  87.    if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && authDo($fum_user, $fum_pass))) {
  88.  
  89.    $value_de=base64_decode($_GET[file]);
  90.    $dl_full=$dir_store."/".$value_de;
  91.    $dl_name=$value_de;
  92.  
  93.    if (!file_exists($dl_full))
  94.    {
  95.    echo"ERROR: Zaladuj plik i sprubuj jeszcze raz.<br><a href=\"$_SERVER[PHP_SELF]\">back</a>";  
  96.    exit();
  97.    }
  98.    
  99.    header("Content-Type: application/octet-stream");
  100.    header("Content-Disposition: attachment; filename=$dl_name");
  101.    header("Content-Length: ".filesize($dl_full));
  102.    header("Accept-Ranges: bytes");
  103.    header("Pragma: no-cache");
  104.    header("Expires: 0");
  105.    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  106.    header("Content-transfer-encoding: binary");
  107.            
  108.    @readfile($dl_full);
  109.    
  110.    exit();
  111.  
  112.    }
  113.    }
  114. }
  115.  
  116. function getlast($toget)
  117. {
  118.    $pos=strrpos($toget,".");
  119.    $lastext=substr($toget,$pos+1);
  120.  
  121.    return $lastext;
  122. }
  123.  
  124. function replace($o)
  125. {
  126.    $o=str_replace("/","",$o);
  127.    $o=str_replace("\","",$o);
  128.    $o=str_replace(":","",$o);
  129.    $o=str_replace("*","",$o);
  130.    $o=str_replace("?","",$o);
  131.    $o=str_replace("<","",$o);
  132.    $o=str_replace(">","",$o);
  133.    $o=str_replace("&#092;"","",$o);
  134.    $o=str_replace("|","",$o);
  135.    
  136.    return $o;
  137. }
  138.  
  139. ?>
  140. <!-- <?=$fum_info_full?> -->
  141.  
  142. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  143. <html>
  144. <head>
  145. <title><? echo ($title) ? ($title) : ("File Upload Manager"); ?></title>
  146. <link rel="stylesheet" href="<?=$dir_img?>/<?=$style?>.css" type="text/css">
  147. <?
  148.    if ($auth_ReqPass == 1)
  149.    {
  150.        if (isset($login) || isset($logout)) {
  151.            echo("<meta http-equiv='refresh' content='2;url=$_SERVER[PHP_SELF]'>");
  152.        }
  153.    }
  154. ?>
  155. </head>
  156. <body bgcolor="black"><br><br>
  157.  
  158. <center>
  159.  
  160. <BR><BR><FONT COLOR="WHITE" SIZE="2"><font color="red">WSKAZOWKA: </font>JEZELI CHCESZ MIEC LINK DO DANEGO PLIKU TO SKOPIUJ ADRES DOWNLOAD :)</FONT><br><br>
  161. <?    
  162.    if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && isset($fum_user) && !isset($logout))) {
  163.    if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && authDo($fum_user, $fum_pass))) {
  164. ?>
  165. <table width="560" cellspacing="0" cellpadding="0" border="1" bordercolor="white" bgcolor="yellow" align="center">
  166.  <tr>
  167.    <td><center><font size="3"><b><i><? echo ($title) ? ($title) : ("File Upload Manager"); ?></i></b></font>&nbsp;<font style="text-decoration: bold; font-size: 9px;">v<?=$fum_vers?></font>&nbsp;
  168. <?
  169.    #--Please do not remove my link/copyright as it is unfair and a breach of the license--#
  170.    echo"<a href=\"http://www.mtnpeak.net\" style=\"text-decoration: none; color: #C0C0C0; font-size: 9px; cursor: default\";>&copy; thepeak</a>";
  171. ?>
  172. </center>   </td>
  173.   </tr>
  174. </table>
  175. <?
  176.    if (!eregi("777",decoct(fileperms($dir_store))))
  177.    {
  178.        echo"<br><br><b><h4><font color=\"FF0000\">ERROR: cannot access the upload store file directory. please chmod the \"$dir_store\" directory with value 0777 (xrw-xrw-xrw)!</h4></font></b><br>ť<a href=\"$_SERVER[PHP_SELF]\">refresh</a>";
  179.    }
  180.    else
  181.    {
  182.        if (!$_FILES[fileupload])
  183.        {
  184. ?>
  185. <br><table bgcolor="#F0E68C" width="560" cellspacing="0" cellpadding="6" border="0" class="table_decoration" style="padding-top:5px;padding-left=5px;padding-bottom:5px;padding-right:5px" >
  186.  <form method="post" enctype="multipart/form-data">
  187.  <tr>
  188.    <td><font size="2">Plik:</font></td><td><input type="file" name="fileupload" class="textfield" size="30"></td>
  189.  </tr>
  190.  <tr>
  191.    <td><font size="2">Zmień nazwe na:</font></td><td><input type="text" name="rename" class="textfield" size="46"></td>
  192.  </tr>
  193.  <tr>
  194.    <td><font size="2">Dozwolone typy plików:</font></td><td>
  195.    <?
  196.    for($i=0;$i<count($file_ext_allow);$i++)
  197.    {
  198.        if (($i<>count($file_ext_allow)-1))$commas=", ";else $commas="";
  199.        list($key,$value)=each($file_ext_allow);
  200.        echo $value.$commas;
  201.    }
  202.    ?>
  203.    </td>
  204.  </tr>
  205.  <tr>
  206.    <td><font size="2">Limit pliku:</font></td>
  207.    <td>
  208.        <b><?
  209.            if ($file_size_ind >= 1048576)
  210.            {
  211.                $file_size_ind_rnd = round(($file_size_ind/1024000),3) . " MB";
  212.            }
  213.            elseif ($file_size_ind >= 1024)
  214.            {    
  215.                $file_size_ind_rnd = round(($file_size_ind/1024),2) . " KB";
  216.            }
  217.            elseif ($file_size_ind >= 0)
  218.            {
  219.                $file_size_ind_rnd = $file_size_ind . " bytes";
  220.            }
  221.            else
  222.            {
  223.                $file_size_ind_rnd = "0 bytes";
  224.            }
  225.            
  226.            echo "$file_size_ind_rnd";
  227.        ?></b>
  228.    </td>
  229.  </tr>
  230.  <tr>
  231.    <td colspan="2"><input type="submit" value="upload" class="button">&nbsp;<input type="reset" value="reset" class="button"></td>
  232.  </tr>
  233.  </form>
  234. </table>
  235. <?
  236.        if ((!$_GET[act]||!$_GET[file])&&$_GET[act]!="delall")
  237.        {
  238.            $opendir = @opendir($dir_store);
  239.  
  240.            while ($readdir = @readdir($opendir))
  241.            {
  242.                if ($readdir<>"." && $readdir<>".." && $readdir != "index.html")
  243.                {
  244.                    $filearr[] = $readdir;
  245.                }
  246.                $sort=array();
  247.                for($i=1;$i<=count($filearr);$i++)
  248.                {
  249.                    $key = sizeof($filearr)-$i;
  250.                    $file = $filearr[$key];
  251.  
  252.                    $sort[$i]=$file;
  253.                }
  254.                asort($sort);
  255.            }
  256. ?>


  1. <br>
  2.  
  3. <?    
  4.            if ($file_list_allow == 1 && (count($filearr) >= 1))
  5.            {
  6. ?>
  7. <table width="560" cellspacing="0" cellpadding="5" border="0" class="table_decoration" style="padding-left:6px">
  8.  <tr bgcolor="yellow">
  9.    <td align="left" width="46%" height="50"><b>NAZWA PLIKU</b></td>
  10.    <td align="center" width="12%"><b>TYP</b></td>
  11.    <td align="center" width="12%"><b>ROZMIAR</b></td>
  12.    <td align="center" width="30%"><b>FUNKCJE</b></td>
  13.  </tr>
  14. <?
  15.                for($i=1;$i<=count($sort);$i++)
  16.                {
  17.                    list($key,$value)=each($sort);
  18.  
  19.                    if ($value)
  20.                    {
  21.                        $value_en = base64_encode($value);
  22.                        $value_view=$value;
  23.                        
  24.                            if (strlen($value) >= 48)
  25.                            {
  26.                                $value_view = substr($value_view, 0, 45) . '...';
  27.                            }
  28. ?>
  29. <tr>
  30.    <td width="30%"><?="<a href=\"?act=view&file=$value_en\">$value_view</a>"?></td>
  31.    <td align="center" width="5%"><? echo strtoupper(getlast($value)); ?></td>
  32.    <td align="center" width="5%"><?
  33.  
  34.        $value_full = $dir_store."/".$value;
  35.        $file_size = filesize($value_full);
  36.        
  37.        if ($file_size >= 1048576)
  38.        {
  39.            $show_filesize = number_format(($file_size / 1048576),2) . " MB";
  40.        }
  41.        elseif ($file_size >= 1024)
  42.        {
  43.            $show_filesize = number_format(($file_size / 1024),2) . " KB";
  44.        }
  45.        elseif ($file_size >= 0)
  46.        {
  47.            $show_filesize = $file_size . " bytes";
  48.        }
  49.        else
  50.        {
  51.            $show_filesize = "0 bytes";
  52.        }
  53.  
  54.        echo "$show_filesize";
  55.        
  56. ?></td>
  57.    <td align="center" width="5%"><?="<a title=\"view\" href=\"?act=view&file=$value_en\">&lt;view&gt;</a>"?> |
  58. <?
  59.    if ($file_del_allow == 1)
  60.    {
  61.        echo"<a title=\"download\" href=\"?act=dl&file=$value_en\">&lt;dl&gt;</a>";
  62.     }
  63.    else
  64.    {
  65.        echo"<a title=\"Download file\" href=\"?act=dl&file=$value_en\">&lt;download&gt;</a>";
  66.    }
  67.  
  68.    if ($file_del_allow == 1)
  69.    {
  70.        echo"&nbsp;|&nbsp;<a title=\"Delete file\" href=\"java script:;\" onClick=\"cf=confirm('Are you sure you want to delete this file?');if (cf)window.location='?act=del&file=$value_en'; return false;\">&lt;delete&gt;</a>";
  71.    }
  72.    else
  73.    {
  74.        echo"&nbsp;";
  75.    }
  76. ?>
  77.    </td>
  78. </tr>
  79. <?
  80.                }
  81.                else
  82.                {
  83.                    echo"<br>";
  84.                }
  85.                }
  86. ?>
  87. </table></center>
  88. <?
  89.            }
  90.        }
  91.        elseif (($_GET[act]=="view")&&$_GET[file])
  92.        {
  93.            $value_de = base64_decode($_GET[file]);
  94.            echo"<script language=\"javascript\">\nViewPopup = window.open(\"$dir_store/$value_de\", \"fum_viewfile\", \"toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,location=no,wid
  95. h=640,height=480\")\nViewPopup.document.bgColor=\"#F7F7F7\"\nViewPopup.document.close()\n</script>";
  96.            echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">file opened!</font></b><br>ť<a href=\"$_SERVER[PHP_SELF]\">back</a><br><br><br>If the file did not display, you must <b>disable</b> your popup manager, or enable javascript in your browser.";
  97.        }
  98.        elseif (($_GET[act]=="del")&&$_GET[file])
  99.        {
  100.            $value_de = base64_decode($_GET[file]);
  101.            @unlink($dir_store."/$value_de");
  102.            echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">file has been deleted!</font></b><br><a href=\"$_SERVER[PHP_SELF]\">back</a>";
  103.        }
  104.        if ($_GET[act]=="delall")
  105.        {
  106.            $handle = opendir($dir_store);
  107.            while($file=readdir($handle))
  108.            if (($file != ".")&&($file != ".."))
  109.            @unlink($dir_store."/".$file);
  110.            closedir($handle);
  111.  
  112.            echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">all files have been deleted!</font></b><br>ť<a href=\"$_SERVER[PHP_SELF]\">POWROT</a>";
  113.        }
  114.  
  115.    }
  116.    else
  117.    {
  118.        echo"<br><br>";
  119.        $uploadpath=$dir_store."/";
  120.        $source=$_FILES[fileupload][tmp_name];
  121.        $fileupload_name=$_FILES[fileupload][name];
  122.        $weight=$_FILES[fileupload][size];
  123.  
  124.        for($i=0;$i<count($file_ext_allow);$i++)
  125.        {
  126.            if (getlast($fileupload_name)!=$file_ext_allow[$i])
  127.                $test.="~~";
  128.        }
  129.        $exp=explode("~~",$test);
  130.  
  131.        if (count($exp)==(count($file_ext_allow)+1))
  132.        {
  133.            echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">ERROR: Typ pliku niedozwolony! (".getlast($fileupload_name).")</font>, lub nie wybrałeś żadnego pliku.</b><br><a href=\"$_SERVER[PHP_SELF]\">POWROT</a>";
  134.        }
  135.        else
  136.        {
  137.  
  138.            if ($weight>$file_size_ind)
  139.            {
  140.                echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">ERROR: Rozmiar pliku musi byc wiekszy od".$file_size_ind." BYTES  (".round(($file_size_ind/1024),2)." KB)</font></b><br><a href=\"$_SERVER[PHP_SELF]\">POWROT</a>";
  141.            }
  142.            else
  143.            {
  144.  
  145.                foreach($_FILES[fileupload] as $key=>$value)
  146.                {
  147.                    echo"<font color=\"#3399FF\">$key</font> : $value <br>";
  148.                }
  149.  
  150.                echo "<br>";
  151.  
  152.                $dest = '';
  153.  
  154.                if (($source != 'none') && ($source != '' ))
  155.                {
  156.                    $dest=$uploadpath.$fileupload_name;
  157.                    if ($dest != '')
  158.                    {
  159.                        if (file_exists($uploadpath.$fileupload_name))
  160.                        {
  161.                            echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">ERROR: Taki plik już istnieje, wybierz inny </font></b><br><a href=\"$_SERVER[PHP_SELF]\">--->>> POWROT</a>";
  162.                        }
  163.                        else
  164.                        {
  165.                            if (copy($source,$dest))
  166.                            {
  167.                                if ($_POST[rename])
  168.                                {
  169.                                    $_POST[rename]=replace($_POST[rename]);
  170.                                    $exfile=explode(".",$fileupload_name);
  171.                                    
  172.                                    if (@rename("$dir_store/$fileupload_name","$dir_store/$_POST[rename].".getlast($fileupload_name)))
  173.                                    {
  174.                                        echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">Nazwa pliku zmieniona na $_POST[rename].".getlast($fileupload_name)."!</font></b></font><br>";
  175.                                    }
  176.                                }
  177.                                echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"4\">Plik załadowany!</font></b><br><a href=\"$_SERVER[PHP_SELF]\"<b>POWROT na UPLOAD</b> </a>";
  178.                            }
  179.                            else
  180.                            {
  181.                                echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">ERROR: cannot upload, please chmod the dir to 777</font></b><br>ť<a href=\"$_SERVER[PHP_SELF]\">back</a>";
  182.                            }
  183.                        }
  184.                    }
  185.                }
  186.            }
  187.        }
  188.    }
  189. }
  190.  
  191. #/# end of main script, start authentication code IF user not logged in IF $auth_ReqPass is enabled
  192.  
  193.    }
  194.    else
  195.    {
  196.        echo("<p><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\">&nbsp;Authentication error</p>" .
  197. "<p><a href='$_SERVER[PHP_SELF]?logout=1'>Delete cookies and login again<a></p>");
  198.    }
  199.    }
  200.    else
  201.    {
  202.  
  203.    if (!isset($login) || isset($relogin)) {
  204. ?>
  205. <font size="3"><b><i><? echo ($title) ? ($title) : ("UPLOAD "); ?></i> - Authentication</b></font><br><br>
  206. <table class="table_auth"><tr><td><center>
  207. Please enter the username and password to enter the restricted area.<br>
  208. You must have cookies enabled in your browser to continue.
  209. </center></td></tr></table>
  210. <form action="<?=$_SERVER[PHP_SELF]?>?login=1" method="POST"><p>
  211. Username: <input type="text" name="auth_formUser" size="20"><br>
  212. Password: <input type="password" name="auth_formPass" size="20">
  213. <p><input type="submit" name="submit" class="button" value="Log-In"></p>
  214. </form></center>
  215. <?
  216.    }
  217.    elseif (isset($login))
  218.    {
  219.        echo("<p>$auth_msg</p>" . "<p>You'll be redirected in 2 seconds!</p>");
  220.    }
  221.    }
  222. ?>
  223. </body>
  224. </html>


LICZE NA POMOC PRZYPOMINAM CHCE DODAC DO UPLOADU TABELE DATA DODANIA WRAZ ZE SKRYPTEM

ps; SORY ALE DALEM CALY SKRYPT tongue.gif
Pawel_W
sorry, ale ja tu nie widze nigdzie w kodzie data dodania

wklej sobie gdzieś coś takiego:

  1. <?php
  2. echo date("d.m.Y, H:i", filemtime("jakis_plik_.txt"));
  3. ?>

tylko zamien to jakis_plik_.txt na jakis inny plik i zobacz co wyjdzie winksmiley.jpg
niki12345
Cytat(Pawel_W @ 20.07.2009, 20:57:20 ) *
sorry, ale ja tu nie widze nigdzie w kodzie data dodania

wklej sobie gdzieś coś takiego:

  1. <?php
  2. echo date("d.m.Y, H:i", filemtime("jakis_plik_.txt"));
  3. ?>

tylko zamien to jakis_plik_.txt na jakis inny plik i zobacz co wyjdzie winksmiley.jpg



Właśnie tylko gdzie to wkleić tak aby po uploadowaniu pliku od razu pokazywala sie data, a i w kodzie nie ma tabeli data dodania bo dopiero chce ją zrobić smile.gif POZDRO
Pawel_W
  1. <table width="560" cellspacing="0" cellpadding="5" border="0" class="table_decoration" style="padding-left:6px">
  2. <tr bgcolor="yellow">
  3.   <td align="left" width="46%" height="50"><b>NAZWA PLIKU</b></td>
  4.   <td align="center" width="12%"><b>TYP</b></td>
  5.   <td align="center" width="12%"><b>ROZMIAR</b></td>
  6.   <td align="center" width="15%"><b>FUNKCJE</b></td>
  7.   <td align="center" width="15%"><b>DATA DODANIA</b></td>
  8. </tr>
  9. <?
  10.               for($i=1;$i<=count($sort);$i++)
  11.               {
  12.                   list($key,$value)=each($sort);
  13.  
  14.                   if ($value)
  15.                   {
  16.                       $value_en = base64_encode($value);
  17.                       $value_view=$value;
  18.                      
  19.                           if (strlen($value) >= 48)
  20.                           {
  21.                               $value_view = substr($value_view, 0, 45) . '...';
  22.                           }
  23. ?>
  24. <tr>
  25.   <td width="30%"><?="<a href=\"?act=view&file=$value_en\">$value_view</a>"?></td>
  26.   <td align="center" width="5%"><? echo strtoupper(getlast($value)); ?></td>
  27.   <td align="center" width="5%"><?
  28.  
  29.       $value_full = $dir_store."/".$value;
  30.       $file_size = filesize($value_full);
  31.      
  32.       if ($file_size >= 1048576)
  33.       {
  34.           $show_filesize = number_format(($file_size / 1048576),2) . " MB";
  35.       }
  36.       elseif ($file_size >= 1024)
  37.       {
  38.           $show_filesize = number_format(($file_size / 1024),2) . " KB";
  39.       }
  40.       elseif ($file_size >= 0)
  41.       {
  42.           $show_filesize = $file_size . " bytes";
  43.       }
  44.       else
  45.       {
  46.           $show_filesize = "0 bytes";
  47.       }
  48.  
  49.       echo "$show_filesize";
  50.      
  51. ?></td>
  52.   <td align="center" width="5%"><?="<a title=\"view\" href=\"?act=view&file=$value_en\">&lt;view&gt;</a>"?> |
  53. <?
  54.   if ($file_del_allow == 1)
  55.   {
  56.       echo"<a title=\"download\" href=\"?act=dl&file=$value_en\">&lt;dl&gt;</a>";
  57.    }
  58.   else
  59.   {
  60.       echo"<a title=\"Download file\" href=\"?act=dl&file=$value_en\">&lt;download&gt;</a>";
  61.   }
  62.  
  63.   if ($file_del_allow == 1)
  64.   {
  65.       echo"&nbsp;|&nbsp;<a title=\"Delete file\" href=\"java script:;\" onClick=\"cf=confirm('Are you sure you want to delete this file?');if (cf)window.location='?act=del&file=$value_en'; return false;\">&lt;delete&gt;</a>";
  66.   }
  67.   else
  68.   {
  69.       echo"&nbsp;";
  70.   }
  71. ?>
  72.   </td>
  73. <td>
  74. <?php
  75. echo date("d.m.Y, H:i", filemtime($value_full));
  76. ?>
  77. </td>
  78. </tr>

zamień na
  1. <table width="560" cellspacing="0" cellpadding="5" border="0" class="table_decoration" style="padding-left:6px">
  2. <tr bgcolor="yellow">
  3.   <td align="left" width="46%" height="50"><b>NAZWA PLIKU</b></td>
  4.   <td align="center" width="12%"><b>TYP</b></td>
  5.   <td align="center" width="12%"><b>ROZMIAR</b></td>
  6.   <td align="center" width="30%"><b>FUNKCJE</b></td>
  7. </tr>
  8. <?
  9.               for($i=1;$i<=count($sort);$i++)
  10.               {
  11.                   list($key,$value)=each($sort);
  12.  
  13.                   if ($value)
  14.                   {
  15.                       $value_en = base64_encode($value);
  16.                       $value_view=$value;
  17.                      
  18.                           if (strlen($value) >= 48)
  19.                           {
  20.                               $value_view = substr($value_view, 0, 45) . '...';
  21.                           }
  22. ?>
  23. <tr>
  24.   <td width="30%"><?="<a href=\"?act=view&file=$value_en\">$value_view</a>"?></td>
  25.   <td align="center" width="5%"><? echo strtoupper(getlast($value)); ?></td>
  26.   <td align="center" width="5%"><?
  27.  
  28.       $value_full = $dir_store."/".$value;
  29.       $file_size = filesize($value_full);
  30.      
  31.       if ($file_size >= 1048576)
  32.       {
  33.           $show_filesize = number_format(($file_size / 1048576),2) . " MB";
  34.       }
  35.       elseif ($file_size >= 1024)
  36.       {
  37.           $show_filesize = number_format(($file_size / 1024),2) . " KB";
  38.       }
  39.       elseif ($file_size >= 0)
  40.       {
  41.           $show_filesize = $file_size . " bytes";
  42.       }
  43.       else
  44.       {
  45.           $show_filesize = "0 bytes";
  46.       }
  47.  
  48.       echo "$show_filesize";
  49.      
  50. ?></td>
  51.   <td align="center" width="5%"><?="<a title=\"view\" href=\"?act=view&file=$value_en\">&lt;view&gt;</a>"?> |
  52. <?
  53.   if ($file_del_allow == 1)
  54.   {
  55.       echo"<a title=\"download\" href=\"?act=dl&file=$value_en\">&lt;dl&gt;</a>";
  56.    }
  57.   else
  58.   {
  59.       echo"<a title=\"Download file\" href=\"?act=dl&file=$value_en\">&lt;download&gt;</a>";
  60.   }
  61.  
  62.   if ($file_del_allow == 1)
  63.   {
  64.       echo"&nbsp;|&nbsp;<a title=\"Delete file\" href=\"java script:;\" onClick=\"cf=confirm('Are you sure you want to delete this file?');if (cf)window.location='?act=del&file=$value_en'; return false;\">&lt;delete&gt;</a>";
  65.   }
  66.   else
  67.   {
  68.       echo"&nbsp;";
  69.   }
  70. ?>
  71.   </td>
  72. </tr>

o ile zmienna $value_full zawiera ścieżkę winksmiley.jpg
niki12345
super działa dzięki wam wszytkim POZDRO smile.gif

Jeszcze jedno pytanko jak zrobić żeby uploadowane pliki ukazywaly sie sortowane zaczynajac od tych najwczesniej dodanych a najpozniej na koncu i jak zrobic zeby na 1 stronie bylo max 2 plikow, a u dolu bylo cos takiego jak u was na forum nastepna strona itd
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2024 Invision Power Services, Inc.