<?PHP 
$backuptime="";
$backresultall1="";
$backresultall2=0;
$backresultall3=0;
$backresultall3a="";

if(isset($_COOKIE["xlanguage"])){
$tlanguage=$_COOKIE["xlanguage"];
}else{
$tlanguage=$adlanguage;
}
if($_COOKIE['sysadmin_pass']==$pass && $_COOKIE['sysadmin_user']==$user){
$checkdokumentroot=$_SERVER['DOCUMENT_ROOT'];
// ********************** TEST **********************
if($backuptest == 1){$checkdokumentroot=$checkdokumentroot."/".$wssiteL."/".$wssiteA."/".$SYST."/backuptest";}
// ****************************************************
$timestamp=time();
@$backuptime=date("Ymd-His",$timestamp);

$checktimebackupdataT=$timestamp;
@$checktimebackupdataD=date("d.m.Y H:i:s",$timestamp);
?>

<div class="box-body">

<div class="padd-lr10">
<div class="box boxStyle2 infoBox margin-b15">
<div class="padd10t">

<table id="tableN" class="col-md-12">
<tr class='tabTop'>
<td colspan="2"><div class='padd-left10'>

<?PHP 
$handle=opendir("./../backup/");
if($handle)
$backupAnz=0;
while($file=readdir($handle))
{$backupAnz++;}
$backupAnz=$backupAnz-2;
$backupinfo=$backupAnz+1;

$backupFolder="./../backup/";
$backupfiles=opendir($backupFolder);
while ($backuparray=readdir($backupfiles)){
$backuparr[]=$backuparray;
}
closedir($backupfiles);
foreach($backuparr as $backupfileX)
if($backupfileX != '.' && $backupfileX != '..'){
@$backresultall1 += filesize($backupFolder."/".$backupfileX);
$backresultall2=$backresultall1/1024;
$backresultall3=$backresultall2/1024;
$backresultall2=number_format($backresultall2,2,",",".");
$backresultall3=number_format($backresultall3,2,",",".");
@$backresultall3a=number_format($backresultall3,0);
}

if($backresultall3a >= $backupMB){
echo "<span class='resF fwb'>".$backupdata41."</span>
<br>
<br>
<b>".$backupdata23." ".$backupdata36." ".$backupMB." ".$backupdata37." ".$backupdata38." (".$backupdata39.": ".$backresultall3." ".$backupdata37.")!</b><br>".$backupdata26
;
}else{
if($backupAnz >= $backupno){
echo "<span class='resF fwb'>".$backupdata41."</span>
<br>
<br>
<b>".$backupdata23." ".$backupdata24." ".$backupno." ".$backupdata22." ".$backupdata25."</b>
<br>
".$backupdata26
;
}else{

include('./../function/pclzip.lib.inc.php');
$newzip= new PclZip('./../backup/backup__'.$backuptime.'.zip');
$file_list = $newzip->create($checkdokumentroot);

if ($file_list == 0){
die("Error : ".$newzip->errorInfo(true));
}
echo "
<span class='resT'>".$backupdata43."</span>
<br>
<br>";

}
}

$bfileX="./../backup/backup__".$backuptime.".zip";
if (file_exists($bfileX)){

$backupdataX="<?PHP 
\$checktimebackupdataD='$checktimebackupdataD';
\$checktimebackupdataT='$checktimebackupdataT';
?>";
$handle=fopen("./../".$SYSD."/backupdata.inc.php", "w");
fwrite($handle,$backupdataX);
fclose($handle);

$filesizeLast=filesize($bfileX);
$filesizeLast=$filesizeLast / 1024 / 1024;
$filesizeLast=number_format($filesizeLast, 4, ',', '.');

echo "
<u><b>".$backupdata22." ".$backupdata27." ".$backupinfo.":</b></u>
<br>
<br>
".$backupdata29." ".$backupdata21." ".$backupdata30." <b> backup__".$backuptime."</b> ".$backupdata31."
<br>
<br>
<b>".$backupdata40.": ".$filesizeLast." ".$backupdata37."</b>
<br>
<br>
<b>".$backupdata32.":</b> ".$backupdata33."
<br>
<br>
<b>".$backupdata34.":</b> ".$backupdata35
;
}else{
//echo "<br><span class='resF fwb'>".$backupdata42."</span>";
}
}else{
include("./../function/zip.inc.php");
}

echo "
<br>
<br>
<a href='$ilink'>
<div class='vlinkS'>
<i class='hvL fa fa-arrow-circle-right padd-right5'></i>
<span class='hvS'>".$back1."</span>
</div>
</a>
";
?>
</div>
</td>
</tr>

</table>
<div class="clearX box-footer"></div>
</div>
</div>
</div>

</div>
