Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pobranie pojemności konto, wolne i całkowita pojemnośc konta
angel2953
post
Post #1





Grupa: Zarejestrowani
Postów: 199
Pomógł: 5
Dołączył: 8.07.2004
Skąd: gdynia

Ostrzeżenie: (0%)
-----


jak pobrać wolne miejsce i całkowite miesce konta?? Próbowałem
  1. <?php
  2.  
  3. $total = disk_total_space ( $DOCUMENT_ROOT );
  4. $free = disk_free_space ( $DOCUMENT_ROOT );
  5.  
  6. ?>

ale jakoś mi dziwne liczby zwraca... Konto ma pojemność 40 MB a mi zwraca 57215778816...
Please Help....
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
tiraeth
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 789
Pomógł: 41
Dołączył: 30.10.2003
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


A może dlatego, że rozmiar zwracany jest w bajtach (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)

spróbój:
  1. <?php
  2. $total = disk_total_space($DOCUMENT_ROOT);
  3. $free = disk_free_space($DOCUMENT_ROOT);
  4.  
  5. if($total >= 1024)
  6. {
  7.  $total = sprintf('%01.2f', $total/1024);
  8.  $total.= 'kb';
  9. }
  10. elseif($total >= (1024*1024))
  11. {
  12.  $total = sprintf('%01.2f', $total/(1024*1024));
  13.  $total.= 'mb';
  14. }
  15. else
  16. {
  17.  $total.= 'b';
  18. }
  19.  
  20. if($free >= 1024)
  21. {
  22.  $free = sprintf('%01.2f', $free/1024);
  23.  $free.= 'kb';
  24. }
  25. elseif($free >= (1024*1024))
  26. {
  27.  $free = sprintf('%01.2f', $free/(1024*1024));
  28.  $free.= 'mb';
  29. }
  30. else
  31. {
  32.  $free.= 'b';
  33. }
  34. ?>
Go to the top of the page
+Quote Post
angel2953
post
Post #3





Grupa: Zarejestrowani
Postów: 199
Pomógł: 5
Dołączył: 8.07.2004
Skąd: gdynia

Ostrzeżenie: (0%)
-----


(IMG:http://forum.php.pl/style_emoticons/default/blink.gif) (IMG:http://forum.php.pl/style_emoticons/default/blink.gif) (IMG:http://forum.php.pl/style_emoticons/default/blink.gif) (IMG:http://forum.php.pl/style_emoticons/default/blink.gif) (IMG:http://forum.php.pl/style_emoticons/default/blink.gif) (IMG:http://forum.php.pl/style_emoticons/default/blink.gif) (IMG:http://forum.php.pl/style_emoticons/default/blink.gif)
teraz mi wyświetla, że mam 54 GB miesca na koncie z czego 24 mam wykorzystane (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)

  1. Pojemność konta: 54565.22 MB
  2. Pozostałe miejsce: 24466.84 MB


nie wiem co jest nie tak... bo w panelu administracyjnym mojego konta mam:

  1. Pojemność konta: 40 MB
  2. Pozostałe miejsce: 33.63 MB


albo to ja już fixuje albo php... (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)
Go to the top of the page
+Quote Post
silent
post
Post #4





Grupa: Zarejestrowani
Postów: 127
Pomógł: 0
Dołączył: 18.08.2004
Skąd: Jastrzębie Zdrój

Ostrzeżenie: (0%)
-----


Po prostu skrypt zwraca Ci pojemność i ilość wolnego miejsca na całym dysku, a nie na koncie. Trudno na to wpaść?
Go to the top of the page
+Quote Post
Jojo
post
Post #5





Grupa: Zarejestrowani
Postów: 405
Pomógł: 1
Dołączył: 19.09.2003
Skąd: Lublin

Ostrzeżenie: (0%)
-----


Pokombinuj sobie z
  1. <?php
  2. exec( 'quota' );
  3. ?>

i przeparsuj wyniki zwracane przez tą funkcję.
Go to the top of the page
+Quote Post
angel2953
post
Post #6





Grupa: Zarejestrowani
Postów: 199
Pomógł: 5
Dołączył: 8.07.2004
Skąd: gdynia

Ostrzeżenie: (0%)
-----


niestety funkcję exec mam wyłączoną ze względów bezpieczeństwa na tym serwerze... (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)

Ten post edytował angel2953 3.11.2004, 16:48:15
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.12.2025 - 17:24