Jump to content

need help on Hard DIsk Space Calculation


nitram128

Recommended Posts

need help on Monitoring Hard disk space on other computers on the network

 

I already created a program to calculate my own HARD DISK

 

My problem is when I try to code the other network computer my error was "access Denied" or "device not ready when the other Computer is OFF

 

I have tried a software that can do it (Disk Monitor Pro)

 

I cant Figure it out how to Make it work.. plss help. .

 

P.S. I am newbie in php

 

 

<html>

<head>

 

<?php

 

 

/* get disk space free (in bytes) */

$df = disk_free_space("//Grahambelaperia/d");

$df2 = disk_free_space("Z:");

/* and get disk space total (in bytes) */

$dt = disk_total_space("//Grahambelaperia/d");

$dt2 = disk_total_space("Z:");

/* now we calculate the disk space used (in bytes) */

$du = $dt - $df;

$du2 = $dt2 - $df2;

/* percentage of disk used - this will be used to also set the width % of the progress bar */

$dp = sprintf('%.2f',($du / $dt) * 100);

$dp2 = sprintf('%.2f',($du2 / $dt2) * 100);

/* and we formate the size from bytes to MB, GB, etc. */

$df = formatSize($df);

$du = formatSize($du);

$dt = formatSize($dt);

$df2 = formatSize($df2);

$du2 = formatSize($du2);

$dt2 = formatSize($dt2);

 

 

function formatSize( $bytes )

{

$types = array( 'B', 'KB', 'MB', 'GB', 'TB' );

for( $i = 0; $bytes >= 1024 && $i < ( count( $types ) -1 ); $bytes /=1024, $i++ );

return( round( $bytes, 2 ) . " " . $types[$i] );

}

 

?>

 

 

<style type='text/css'>

 

.progress {

border: 2px solid #5E96E4;

height: 32px;

width: 540px;

margin: 75px auto;

}

 

.progress .prgbar {

background: Gold;

width: <?php echo "$dp;" ?>%;

position: relative;

height: 32px;

z-index: 999;

}

.progress .prgbar2 {

background: Gold;

width: <?php echo "$dp2;" ?>%;

position: relative;

height: 32px;

z-index: 999;

}

 

.progress .prgtext {

color: white;

text-align: center;

font-size: 15px;

padding: 9px 0 0;

width: 540px;

position: absolute;

z-index: 1000;

}

.progress .prginfo {

margin: 3px 0;

}

 

 

 

</style>

 

 

</head>

 

<body bgcolor = "purple">

 

 

<div class='progress'>

<div class='prgtext'><?php echo $dp; ?>% Disk Used of <?php echo " ".$dt; ?>

</div>

<div class='prgbar'></div>

<div class='prginfo'>

<span style='float: left;'><?php echo "Drive C:"; ?></br>

<?php echo "$du used space of $dt"; ?></br>

<?php echo "$df free space of $dt"; ?></br>

 

 

</span>

 

 

<span style='clear: both;'></span>

</div>

</div>

 

 

<div class='progress'>

<div class='prgtext'><?php echo $dp2; ?>% Disk Used of <?php echo " ".$dt2; ?>

</div>

<div class='prgbar2'></div>

<div class='prginfo'>

<span style='float: left;'><?php echo "Drive Z:"; ?></br>

<?php echo "$du2 used space of $dt2"; ?></br>

<?php echo "$df2 free space of $dt2"; ?></br>

 

 

</span>

 

 

<span style='clear: both;'></span>

</div>

</div>

 

 

 

</body>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.