View file modules/admin/diskspace.php

File size: 3.14Kb
<?php
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
$title_page = 'Состояние памяти';
$m_polozhenie = 'В админке';
####################
if(isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw && ($status == '1'))
 {
include ('../../themes/'.$themes.'.php');
  echo'<p class="modul_name"align="center">Состояние памяти</p>';


$user_home = "$putdisk";

$available_space = "$vsegodisk";



$size = '';

function size_of_dir_num($path)
{
$dir = opendir($path);
global $size;
while($d = readdir($dir))
{
if ($d == '.' || $d == '..')
continue;
if(is_file($path.'/'.$d))
{
$size = $size + filesize($path.'/'.
$d);
}
elseif(is_dir($path.'/'.$d))
size_of_dir_num($path.'/'.$d);
}
}
size_of_dir_num('/home2/dyec110/public_html');
$mb = $size / 1024 / 1024 + $sdvigdisk;
$mb = round($mb,2);

$brugtplads =  $mb;

$pladstilbage = $available_space - $brugtplads;

$p = $available_space / 100;
$p_brugtplads = round($brugtplads / $p);
$p_pladstilbage = round($pladstilbage / $p);

$bredde_brugt = $p_brugtplads * 3;	# This is used as the "width" attribute in the "<img>" tag.
$bredde_tilbage = $p_pladstilbage * 3;	# This is used as the "width" attribute in the "<img>" tag.

function afrunding($tal)
{
if (ereg("\.", $tal)) {					# Example: $tal = 12.2547821
		$tal = split("\.", $tal);			# $tal[0] = 12 and $tal[1] = 2547821
		$tal[1] = substr($tal[1], 0, 2);		# $tal[1] = 25
		$ciffer1 = substr($tal[1], 0, 1);		# $ciffer1 = 2
		$ciffer2 = substr($tal[1], 1, 2);		# $ciffer2 = 5
		if ($ciffer2 >= 5) $ciffer1 = $ciffer1 + 1;	# $ciffer1 now becomes 3
		$tal = "$tal[0].$ciffer1";			# $tal is now 12.3
	}
	return $tal;
}
echo'<p class="b">';
echo "<img src=image.gif height=20 width=$bredde_brugt alt=\"Занятая память: $p_brugtplads%\"><br />";
	echo "<img src=image_gray.gif height=20 width=$bredde_tilbage alt=\"Свободная память: $p_pladstilbage%\"><br />";

	echo "<img src=image.gif height=20 width=10 alt=\"Всего памяти:\"><img src=image_gray.gif height=20 width=10 alt=\"Всего памяти\">";
	echo " Всего памяти: $available_space Mb (100%)<br />";
	echo "<img src=image.gif height=20 width=20 alt=\"Занятая память\">";
	echo " Занятая память: ".afrunding($brugtplads)." Mb ($p_brugtplads%)<br />";
	echo "<img src=image_gray.gif height=20 width=20 alt=\"$l5\">";
	echo " Свободная память: ".afrunding($pladstilbage)." Mb ($p_pladstilbage%)<br />";
echo'</p>';
echo'<p><a href="index.php?'.session_name().'='.session_id().'">В админку</a><br />';
  echo'<a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a></p>';
include ('../../templates/foot.php');
}
else
{
include ('../../themes/'.$themes.'.php');
echo'<p class="err">Ошибка!!! Вы не авторизованы. Войдите в личный кабинет.</p>';
echo'<p><a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a></p>';
include ('../../templates/foot.php');
}
?>