WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Unix Disk Information with graphs
Categories : PHP, Shell Scripting, Filesystem Click here to Update Your Picture
David Perez
Date : Apr 23rd 2005
Grade : 4 of 5 (graded 2 times)
Viewed : 6153
File : 4139.zip
Images : No Images for this code example.
Search : More code by David Perez
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?
/*
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>



Finds files on your site, uses UNIX find command.
Categories : Complete Programs, Filesystem, PHP
Show Source with Line Numbers
Categories : PHP, Regexps, Filesystem
Search and Replace Text : Searches Files for Specified Text and Replaces It by a Given Text
Categories : PHP, PHP Classes, Search, Filesystem
Moving folder hierarchy b/w server
Categories : PHP, FTP, Filesystem
Image Browser
Categories : Filesystem, GD image library, Content Management, PHP
PHP Transfer data from text file to Mysql Table
Categories : PHP, PHP Classes, Filesystem, Databases, MySQL
Differences between two files
Categories : PHP, Filesystem, Tip
a file explorer for the web, filesystem php php3 files dirs directories pictures files windows linux system list ls scripts
Categories : PHP, URLs, Directories, Filesystem
Disk Usage, uses UNIX du command.
Categories : Complete Programs, PHP, Filesystem
PHP based Contact email form with multiple recipients, text file based, supports departments.
Categories : PHP, Email, Beginner Guides, Filesystem
Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
Functions to read a template file and fill in PHP variables. It will also fill in array variables, displaying parts of the template multiple times.
Categories : PHP, Variables, Filesystem
Massreplace
Categories : Filesystem, Regexps, Strings, PHP
How to find the name of the current file?
Categories : PHP, Filesystem, Strings
A simple configuration file editor to ease you life in setting up php applications. Reads variables from a given file automatically and displays current value. New value will be written to file after submit.
Categories : PHP, Filesystem, Regexps, Java Script