diff --git a/DiskStatus.class.php b/DiskStatus.class.php deleted file mode 100644 index b988175..0000000 --- a/DiskStatus.class.php +++ /dev/null @@ -1,73 +0,0 @@ -diskPath = $diskPath; - } - - - public function totalSpace($rawOutput = false) { - $diskTotalSpace = @disk_total_space($this->diskPath); - - if ($diskTotalSpace === FALSE) { - throw new Exception('totalSpace(): Invalid disk path.'); - } - - return $rawOutput ? $diskTotalSpace : $this->addUnits($diskTotalSpace); - } - - - public function freeSpace($rawOutput = false) { - $diskFreeSpace = @disk_free_space($this->diskPath); - - if ($diskFreeSpace === FALSE) { - throw new Exception('freeSpace(): Invalid disk path.'); - } - - return $rawOutput ? $diskFreeSpace : $this->addUnits($diskFreeSpace); - } - - - public function usedSpace($precision = 1) { - try { - return round((100 - ($this->freeSpace(self::RAW_OUTPUT) / $this->totalSpace(self::RAW_OUTPUT)) * 100), $precision); - } catch (Exception $e) { - throw $e; - } - } - - - public function getDiskPath() { - return $this->diskPath; - } - - - private function addUnits($bytes) { - $units = array( 'B', 'KB', 'MB', 'GB', 'TB' ); - - for($i = 0; $bytes >= 1024 && $i < count($units) - 1; $i++ ) { - $bytes /= 1024; - } - - return round($bytes, 1).' '.$units[$i]; - } - -} - -?> - \ No newline at end of file diff --git a/space_old.php b/space_old.php deleted file mode 100644 index e0aefd8..0000000 --- a/space_old.php +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - "0") { - try { - $diskStatusC = new DiskStatus("$drive1"); - - $freeSpaceC = $diskStatusC->freeSpace(); - $totalSpaceC = $diskStatusC->totalSpace(); - $barWidthC = ($diskStatusC->usedSpace()/100) * 150; - -} catch (Exception $e) { - echo 'Error ('.$e->getMessage().')'; - exit(); -} -} - -try { - $diskStatus1 = new DiskStatus("$drive2"); - - $freeSpace1 = $diskStatus1->freeSpace(); - $totalSpace1 = $diskStatus1->totalSpace(); - $barWidth1 = ($diskStatus1->usedSpace()/100) * 150; - -} catch (Exception $e) { - echo 'Error ('.$e->getMessage().')'; - exit(); -} -try { - $diskStatus2 = new DiskStatus("$drive3"); - - $freeSpace2 = $diskStatus2->freeSpace(); - $totalSpace2 = $diskStatus2->totalSpace(); - $barWidth2 = ($diskStatus2->usedSpace()/100) * 150; - -} catch (Exception $e) { - echo 'Error ('.$e->getMessage().')'; - exit(); -} - -try { - $diskStatus3 = new DiskStatus("$drive4"); - - $freeSpace3 = $diskStatus3->freeSpace(); - $totalSpace3 = $diskStatus3->totalSpace(); - $barWidth3 = ($diskStatus3->usedSpace()/100) * 150; - -} catch (Exception $e) { - echo 'Error ('.$e->getMessage().')'; - exit(); -} - -try { - $diskStatus4 = new DiskStatus("$drive5"); - - $freeSpace4 = $diskStatus4->freeSpace(); - $totalSpace4 = $diskStatus4->totalSpace(); - $barWidth4 = ($diskStatus4->usedSpace()/100) * 150; - -} catch (Exception $e) { - echo 'Error ('.$e->getMessage().')'; - exit(); -} - -try { - $diskStatus5 = new DiskStatus("$drive6"); - - $freeSpace5 = $diskStatus5->freeSpace(); - $totalSpace5 = $diskStatus5->totalSpace(); - $barWidth5 = ($diskStatus5->usedSpace()/100) * 150; - -} catch (Exception $e) { - echo 'Error ('.$e->getMessage().')'; - exit(); -} - -try { - $diskStatus6 = new DiskStatus("$drive7"); - - $freeSpace6 = $diskStatus6->freeSpace(); - $totalSpace6 = $diskStatus6->totalSpace(); - $barWidth6 = ($diskStatus6->usedSpace()/100) * 150; - -} catch (Exception $e) { - echo 'Error ('.$e->getMessage().')'; - exit(); -} - -?> - -
-
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Disk Space
\ (of )
-
-
usedSpace() ?>% 
-
-
\ (of )
-
-
usedSpace() ?>% 
-
-
\ (of )
-
-
usedSpace() ?>% 
-
-
\ (of )
-
-
usedSpace() ?>% 
-
-
\ (of )
-
-
usedSpace() ?>% 
-
-
\ (of )
-
-
usedSpace() ?>% 
-
-
\ (of )
-
-
usedSpace() ?>% 
-
-
-
-
- - - \ No newline at end of file