![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 2 Pomógł: 0 Dołączył: 26.01.2008 Ostrzeżenie: (0%) ![]() ![]() |
napisałem taki skrypt:
Kod <html> <head> <meta name="Author" content="Henryk Blaszke"> <meta name="Description" content="Przegladarka plikow na serwerze"> <meta http-equive="Page-Enter" content="blendTrans(Duration=3,Transition=3)"/> <meta http-equive="Page-Exit" content="blendTrans(Duration=3'Transition=4)"> <title>Przegladarka plikow</title> </head> <body bgcolor="grey"> <center> <table border=2 <table border=2 cellspacing=0 cellpadding=0 width=700 class="main"><tr><td> <table border=2 cellspacing=0 cellpadding=0 width=700 height=60 bgcolor="white"><tr><td align=center> </td</tr> <tr><td> <table border=1 width=500 align=center> <tr><th></th><th aling=left>Nazwa</th><th align="center"> Typ </th><th align="center">Rozmiar</th></tr> <?php function nazwa($name) { $Ext = explode ('.', $name); $Ext = strtolower (end ($Ext)); if (in_array ($Ext, array('html', 'htm'))) $FileExt = 'html'; else if (in_array ($Ext, array('pdf'))) $FileExt = 'pdf'; else if (in_array ($Ext, array('txt', 'css', 'sql', 'c', 'cpp', 'cgi'))) $FileExt = 'txt'; else if (in_array ($Ext, array('doc'))) $FileExt = 'dokument'; else if (in_array ($Ext, array('php'))) $FileExt = 'php'; else if (in_array ($Ext, array('ppt', 'pps'))) $FileExt = 'prezentacja'; else if (in_array ($Ext, array('exe'))) $FileExt = 'plik exe'; else if (in_array ($Ext, array('xls', 'xlw'))) $FileExt = 'arkusz kalkulacyjny'; else if (in_array ($Ext, array('avi' ,'mpg', 'mpeg'))) $FileExt = 'film'; else if (in_array ($Ext, array('mp3', 'vaw'))) $FileExt = 'muzyka'; else if (in_array ($Ext, array('zip', 'rar', 'tar', 'gz', 'tgz', 'bz2'))) $FileExt = 'archiwum'; else if (in_array ($Ext, array('bmp', 'gif', 'jpg', 'jpeg', 'png'))) $FileExt = 'obraz'; else if (is_dir) $FileExt = 'folder'; return ($FileExt?$FileExt:'nieznany'); } function ikona($name) { $Ik = explode ('.', $name); $Ik = strtolower (end ($Ik)); if (in_array ($Ik, array('html', 'htm'))) $FileIk = '<img src="a/html.png" alt="image" />'; else if (in_array ($Ik, array('pdf'))) $FileIk = '<img src="a/pdf.png" alt="image" />'; else if (in_array ($Ik, array('txt', 'css', 'sql', 'c', 'cpp', 'cgi'))) $FileIk = '<img src="a/txt.png" alt="image" />'; else if (in_array ($Ik, array('doc'))) $FileIk = '<img src="a/doc.png" alt="image" />'; else if (in_array ($Ik, array('php'))) $FileIk = '<img src="a/doc.png" alt="image" />'; else if (in_array ($Ik, array('ppt', 'pps'))) $FileIk = '<img src="a/prez.png" alt="image" />'; else if (in_array ($Ik, array('exe'))) $FileIk = '<img src="a/exe.png" alt="image" />'; else if (in_array ($Ik, array('xls', 'xlw'))) $FileIk = '<img src="a/excel.png" alt="image" />'; else if (in_array ($Ik, array('avi' ,'mpg', 'mpeg'))) $FileIk = '<img src="a/video.png" alt="image" />'; else if (in_array ($Ik, array('mp3', 'vaw'))) $FileIk = '<img src="a/audio.png" alt="image" />'; else if (in_array ($Ik, array('zip', 'rar', 'tar', 'gz', 'tgz', 'bz2'))) $FileIk = '<img src="a/zip.png" alt="image" />'; else if (in_array ($Ik, array('bmp', 'gif', 'jpg', 'jpeg', 'png'))) $FileIk = '<img src="a/obraz.png" alt="image" />'; else if (is_dir) $FileIk = '<img src="a/folder.png" alt="image" />'; return ($FileIk?$FileIk:'<img src="a/inne.png" alt="image" />'); } function size_hum_read($size) { $i=0; $sum_all=0; $iec = array("B", "KB", "MB"); while (($size/1024)>1) { $size=$size/1024; $i++; } return substr($size,0,strpos($size,'.')+4)." ".$iec[$i]; } $teraz=getcwd(); $catalog = opendir($teraz); while (false !== ($file = readdir($catalog))) { $sum_all = $sum_all+filesize("$teraz/$file"); $size = size_hum_read((filesize("$teraz/$file"))); if (($file != ".") && ($file!="..")) { echo ("<tr>"); echo ("<td></td>"); echo ("<td width=300><a href='$file'>".ikona($file)."$file</a></td>"); echo ("<td width=100 align=center>".nazwa($file)."</td>"); echo ("<td width=100 align=center>$size</td>"); echo ("</tr>\n"); } } closedir($catalog); ?> </table> </td></tr> </table> </table> <font size="14"> <?php echo ("<i>Razem: ".size_hum_read($sum_all)."</i>"); ?> </font> <br><br> <form method="post" action="upload.php" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="30000"> Wybierz plik który chcesz umie¶cić na serwerze:<br><br> <input type="file" name="pliczek" size="40"><br><br> <input type="submit" value="Upload"><br> <b>Projekt zaliczeniowy z przedmiotu SIECI KOMPUTEROWE<br> wykonawca: Henryk Blaszke<br> nr indeksu: 8815</b><br> <img src="a/logo.jpg"> </center> </body> </html> mój problem polega na tym, że kiedy chce otworzyć folder otwiera sie on w formie domyślnej dla przeglądarki, a chciałbym żeby po kliknięciu na folder jago zawartość była wyświetlana w tej samej formie co katalogu głównego http://iis.pwsz.elblag.pl/~iis8815/pliki/index.php |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 749 Pomógł: 37 Dołączył: 3.10.2006 Ostrzeżenie: (0%) ![]() ![]() |
Musisz ścieżke przekazywać przez geta i tak też linkować foldery, po czym dorzucić to do ścieżki tego który folder wyświetla...
-------------------- |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 2 Pomógł: 0 Dołączył: 26.01.2008 Ostrzeżenie: (0%) ![]() ![]() |
można troche jaśniej? dopiero zaczynam przygode z php i nie wiem jak się za to zabrać
moze mógłbyś podać jakiś przykład? |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 24.07.2025 - 19:16 |