fix drive space

This commit is contained in:
Karl Hudgell 2015-07-05 07:52:52 +01:00
parent a35c38e763
commit a46f04efc7
2 changed files with 51 additions and 166 deletions

View File

@ -20,10 +20,15 @@ $drive1visible = "1"; // Set drive visible or not 0 = no 1 = yes
$drive1 = "C:"; // Set the hard drives to display
$drive2visible = "1";
$drive2 = "D:";
$drive3visible = "1";
$drive3 = "E:";
$drive4visible = "1";
$drive4 = "F:";
$drive5visible = "1";
$drive5 = "G:";
$drive6visible = "1";
$drive6 = "H:";
$drive7visible = "1";
$drive7 = "J:";
$server1name = ""; // Set to Server Name to track

200
space.php
View File

@ -36,172 +36,52 @@ indicateSelected(formref.switchcontrol)
}
</script>
</head>
<div id="style">
<div class="innertube">
<table width='190' border='0' cellspacing='0' cellpadding='0'>
<tr BGCOLOR='#0066FF'>
<th style='text-align: left;'><font color='white'>Drive Space</font></th>
</tr>
<tr>
<td BGCOLOR='#FFFFFF'>
<body>
</form>
</td>
</table>
<?php include 'config.php';?>
<?php
/**
* Disk Status Class - Example
*
* http://pmav.eu/stuff/php-disk-status/
*
* 22/Aug/2009
*/
require_once 'DiskStatus.class.php';
if ($drive1visible > "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();
require "drives/drive1.php";
}
?>
<?php
if ($drive2visible > "0") {
require "drives/drive2.php";
}
?>
<?php
if ($drive2visible > "0") {
require "drives/drive3.php";
}
?>
<?php
if ($drive2visible > "0") {
require "drives/drive4.php";
}
?><?php
if ($drive2visible > "0") {
require "drives/drive5.php";
}
?><?php
if ($drive2visible > "0") {
require "drives/drive6.php";
}
?>
<?php
if ($drive2visible > "0") {
require "drives/drive7.php";
}
}
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();
}
?>
<body>
<div id="style">
<div class="disktext">
</p>
<table width='190' border='0' cellspacing='0' cellpadding='1'>
<tr><td BGCOLOR='#0066FF'><font color='white'>Disk Space</font></td></tr>
<tr onclick="toggleNextRow(this)"><td BGCOLOR='#FFFFFF'><?php echo $drive1;?>\<?= $freeSpaceC ?> (of <?= $totalSpaceC ?>)</td></tr>
<tr class="hiddenRow">
<td bgcolor='#FFFFFF'>
<div class="disk">
<div class="used" style="width: <?= $barWidthC ?>px"><?= $diskStatusC->usedSpace() ?>%&nbsp;</div>
</div>
</td>
</tr>
<tr onclick="toggleNextRow(this)"><td bgcolor='#FFFFFF'><?php echo $drive2;?>\<?= $freeSpace1 ?> (of <?= $totalSpace1 ?>)</td></tr>
<tr class="hiddenRow">
<td bgcolor='#FFFFFF'>
<div class="disk">
<div class="used" style="width: <?= $barWidth1 ?>px"><?= $diskStatus1->usedSpace() ?>%&nbsp;</div>
</div>
</td>
</tr>
<tr onclick="toggleNextRow(this)"><td bgcolor='#FFFFFF'><?php echo $drive3;?>\<?= $freeSpace2 ?> (of <?= $totalSpace2 ?>)</td></tr>
<tr class="hiddenRow">
<td bgcolor='#FFFFFF'>
<div class="disk">
<div class="used" style="width: <?= $barWidth2 ?>px"><?= $diskStatus2->usedSpace() ?>%&nbsp;</div>
</div>
</td>
</tr>
<tr onclick="toggleNextRow(this)"><td bgcolor='#FFFFFF'><?php echo $drive4;?>\<?= $freeSpace3 ?> (of <?= $totalSpace3 ?>)</td></tr>
<tr class="hiddenRow">
<td bgcolor='#FFFFFF'>
<div class="disk">
<div class="used" style="width: <?= $barWidth3 ?>px"><?= $diskStatus3->usedSpace() ?>%&nbsp;</div>
</div>
</td>
</tr>
<tr onclick="toggleNextRow(this)"><td bgcolor='#FFFFFF'><?php echo $drive5;?>\<?= $freeSpace4 ?> (of <?= $totalSpace4 ?>)</td></tr>
<tr class="hiddenRow">
<td bgcolor='#FFFFFF'>
<div class="disk">
<div class="used" style="width: <?= $barWidth4 ?>px"><?= $diskStatus4->usedSpace() ?>%&nbsp;</div>
</div>
</td>
</tr>
<tr onclick="toggleNextRow(this)"><td bgcolor='#FFFFFF'><?php echo $drive6;?>\<?= $freeSpace5 ?> (of <?= $totalSpace5 ?>)</td></tr>
<tr class="hiddenRow">
<td bgcolor='#FFFFFF'>
<div class="disk">
<div class="used" style="width: <?= $barWidth5 ?>px"><?= $diskStatus5->usedSpace() ?>%&nbsp;</div>
</div>
</td>
</tr>
<tr onclick="toggleNextRow(this)"><td bgcolor='#FFFFFF'><?php echo $drive7;?>\<?= $freeSpace6 ?> (of <?= $totalSpace6 ?>)</td></tr>
<tr class="hiddenRow">
<td bgcolor='#FFFFFF'>
<div class="disk">
<div class="used" style="width: <?= $barWidth6 ?>px"><?= $diskStatus6->usedSpace() ?>%&nbsp;</div>
</div>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>