daily pastebin goal
88%
SHARE
TWEET

Untitled

a guest Feb 16th, 2014 37 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /**
  4. * Disk Status Class - Example
  5. *
  6. * http://pmav.eu/stuff/php-disk-status/
  7. *
  8. * 22/Aug/2009
  9. */
  10.  
  11. require_once 'DiskStatus.class.php';
  12.  
  13. try {
  14.  $diskStatus = new DiskStatus('c:');
  15.  
  16.  $freeSpace = $diskStatus->freeSpace();
  17.   $totalSpace = $diskStatus->totalSpace();
  18.   $barWidth = ($diskStatus->usedSpace()/100) * 400;
  19.  
  20. } catch (Exception $e) {
  21.   echo 'Error ('.$e->getMessage().')';
  22.   exit();
  23. }
  24.  
  25. ?>
  26.  
  27. <<? ?>?xml version="1.0" encoding="UTF-8"?<? ?>>
  28. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  29. <html xmlns="http://www.w3.org/1999/xhtml">
  30.   <head>
  31.     <style>
  32.       body {
  33.         font: bold 30px "Arial";
  34.         letter-spacing: -1px;
  35.       }
  36.  
  37.       .disk {
  38.         border: 4px solid black;
  39.         width: 400px;
  40.         padding: 2px;
  41.       }
  42.  
  43.       .used {
  44.         display block;
  45.         background: red;
  46.         text-align: right;
  47.         padding: 0 0 0 0;
  48.       }
  49.     </style>
  50.     <title>Disk Status</title>
  51.   </head>
  52.   <body>
  53.     <div class="disk">
  54.       <div class="used" style="width: <?= $barWidth ?>px"><?= $diskStatus->usedSpace() ?>%&nbsp;</div>
  55.     </div>
  56.     Free: <?= $freeSpace ?> (of <?= $totalSpace ?>)
  57.   </body>
  58. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top