|
|
|
|
|
|
| |
| <?
/*
This PHP script will show you how many space es aviable on your
Unix servers using df unix command
Tested on FreeBSD 4.x and 5.x
The attached file have the images for the graph
*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Disk Information</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="100">Device</td>
<td width="100">Used Mb.</td>
<td width="100">Avial Mb.</td>
<td width="100">Mounted on</td>
<td>Graph
</td>
<td>Used %</td>
</tr>
<?
//Getting the information and pre filtering it
//the first grep cut the procfs that allways is show as 100% used
//the second one cut the header line
//next use awk to get only the wanted columns
//finally saving the data to a tmp file
exec("df -k | grep -v procfs|grep -v Filesystem|grep -v \"devfs\"|awk '{print $1\",\"$3\",\"$4\",\"$6\",\"$5}'>/tmp/df.tmp");
//reading the data to the memory from the file
$datos = file("/tmp/df.tmp");
//Cleaning Disk Space
unlink("/tmp/df.tmp");
for ($x=0;$x<sizeof($datos);$x++)
{
//spliting the info previusly saved with "," separatoy
list($device,$used,$remain,$mountpoint,$porcentaje) = split(",",$datos[$x]);
//Calculating the multiplier digit for the bar graph
$total = ($used + $remain);
$ajuste = ($remain/$total);
//Displaying the data
?>
<tr>
<td width="100" align="right"><?=$device;?> </td>
<!-- Convert the bytes in Mega bytes-->
<td width="100" align="right"><?=number_format(($used/1024),2);?> </td>
<td width="100" align="right"><?=number_format(($remain/1024),2);?> </td>
<td width="100" align="right"><?=$mountpoint;?> </td>
<!-- Make sure to change to the correct path for the images-->
<td><table width="150" height="15" border="0" align="center" cellpadding="0" cellspacing="0" background="img/barra_fondo.jpg">
<tr>
<td width="150" height="15" align="right"><img src="img/barra.gif" border="1" width="<?=(150 * $ajuste);?>" height="13"></td>
</tr>
</table>
</td>
<td> <?=$porcentaje;?></td>
</tr>
<?
}
//enjoy it...
?>
</table>
</body>
</html> | | |
|
| file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | Introduction to Language Files Categories : PHP, Filesystem, Beginner Guides | | | Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | | | php jump urls...the best way Categories : PHP, URLs, Filesystem | | | Simple way to replace a variable value in a .conf (.ini) file using a
webbrowser - the first stage of a complete universal configuration editor Categories : PHP, Regexps, Code Editors, Filesystem | | | Display list of files within current and subdirectories (recursively) showing
each file as an anchored link and each directory as a category header. Categories : Filesystem, Directories, Arrays, PHP | | | File Explorer, browse, upload, download and edit your web site files with only a browser and a HTTP connection. Categories : Complete Programs, Content Management, Filesystem, PHP | | | Simple pipe delimited file export program that downloads to a local machine Categories : PHP, Filesystem, Databases, MySQL, HTTP | | | Recursive function to move files on a filesystem. It can be minor changed in order to copy recursively.
Categories : PHP, Filesystem, Algorithms | | | The toll booth Categories : PHP, Java Script, Filesystem | | | Extended Get File List Function Categories : PHP, Filesystem, Search, Directories | | | GuestBook Light - a plug and play application for any website. Categories : PHP, Complete Programs, Filesystem, Sessions | | | JSON File Upload Categories : PHP, AJAX, Filesystem | | | Get the correct extension and MIME types of an image, even when the filename is incorrect. Categories : PHP, Filesystem, General SQL | | | basename -- Returns filename component of path Categories : PHP, PHP Functions, Filesystem | |
|
|
|