Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
- <title>Wskaźnik wolnej przestrzeni dla serwera <? echo $_SERVER["SERVER_ADDR"];?></title>
- </head>
- <body>
- <?php
- $df = disk_free_space("/var/www");
- $dt = disk_total_space("/var/www");
- $du = $dt - $df;
- $dp = sprintf('%.2f',($du / $dt) * 100);
- $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 ) . " " . $types[$i] );
- }
- ?>
- <style type='text/css'>
- h2 {
- text-align: center;
- }
- .progress {
- border: 2px solid #5E96E4;
- height: 32px;
- width: 540px;
- margin: 30px auto;
- }
- .progress .prgbar {
- background: #A7C6FF;
- width: <?php echo $dp; ?>%;
- position: relative;
- height: 32px;
- z-index: 999;
- }
- .progress .prgtext {
- color: #286692;
- text-align: center;
- font-size: 13px;
- padding: 9px 0 0;
- width: 540px;
- position: absolute;
- z-index: 1000;
- }
- .progress .prginfo {
- margin: 3px 0;
- }
- </style>
- <h2>Wskaźnik wolnej przestrzeni dla serwera <? echo $_SERVER["SERVER_ADDR"];?></h2>
- <div class='progress'>
- <div class='prgtext'><?php echo $dp; ?>% zajętej przestrzeni dyskowej</div>
- <div class='prgbar'></div>
- <div class='prginfo'>
- <span style='float: left;'><?php echo "$du z $dt używanej przestrzeni"; ?></span>
- <span style='float: right;'><?php echo "$df z $dt wolnej przestrzeni"; ?></span>
- <span style='clear: both;'></span>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment