MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /var/www/html/blog/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/blog/hdd_check.php
<?php
/* get disk space free (in bytes) */
$df = disk_free_space("/");
/* and get disk space total (in bytes)  */
$dt = disk_total_space("/");
/* now we calculate the disk space used (in bytes) */
$du = $dt - $df;

/*
echo "free space: ".$dt." bytes<br/>";
echo "disk total: ".$df." bytes<br/>";
echo "balance: ".$du." bytes<br/>";

/* percentage of disk used - this will be used to also set the width % of the progress bar */
$dp = sprintf('%.2f',($du / $dt) * 100);

/* and we formate the size from bytes to MB, GB, etc. */
$df = formatSize($df);
$du = formatSize($du);
$dt = formatSize($dt);

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 ) );
}


//$q = mysql_query("insert into log_hdd(log_serv_ip, log_date, disk_total, disk_free, disk_used) values('123.242.173.132',now(),'$dt','$df','$du')");

//$ans = array('ip'=>'123.242.173.132', 'dt'=>$dt, 'df'=>$df, 'du'=>$du);
//echo json_encode($ans);
echo "'123.242.173.131','$dt','$df','$du'";
//echo "{ip:123.242.173.132}PTN-Disk check -> ip: 123.242.173.132 total: $dt, free: $df, used: $du";
?>

Anon7 - 2021