Rev 354 | Rev 411 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><!-- written by Rexy -->
<HEAD>
<TITLE>Sauvegarde</TITLE>
<link rel="stylesheet" href="/css/style.css" type="text/css">
</HEAD>
<body>
<?
# choice of language
$Language = "en";
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]),0,2));}
if ($Language == 'fr'){
$l_backups = "Sauvegarde";
$l_user_db_save = "Sauvegarder la base des usagers";
$l_system_iso = "Créer une image ISO à chaud du système";
$l_execute = "Exécuter";
$l_warning = "(attention, la création de l'image ISO du système dure plusieurs dizaines de minutes)";
$l_backup_files = "Fichiers disponibles pour archivage";
$l_firewall_log = "Journaux du parefeu (Firewall)";
$l_users_db_files = "Base des usagers";
$l_iso_files = "images ISO du système";
}
else {
$l_backups = "Backups";
$l_user_db_save = "Save the users database";
$l_system_iso = "Create a system iso image";
$l_execute = "Execute";
$l_warning = "(warning, the creation of the system iso image takes few minutes)";
$l_backup_files = "Archive backup files";
$l_firewall_log = "Firewall log files";
$l_users_db_files = "Users database";
$l_iso_files = "System ISO images";
}
function taille_fichier($fichier)
{
$taille_fichier = filesize($fichier);
if ($taille_fichier >= 1073741824){
$taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";}
elseif ($taille_fichier >= 1048576){
$taille_fichier = round($taille_fichier / 1048576 * 100) / 100 . " Mo";}
elseif ($taille_fichier >= 1024){
$taille_fichier = round($taille_fichier / 1024 * 100) / 100 . " Ko";}
else {$taille_fichier = $taille_fichier . " o";}
return $taille_fichier;
}
?>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th><? echo $l_backups;?></th></tr>
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
</TABLE>
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
<tr><td valign="middle" align="left">
<FORM action="sauvegarde.php" method=POST><b>
<select name='choix'></b>
<option value="sauvegarde_DB"><?echo "$l_user_db_save";?>
<option value="archivage_logs"><?echo "$l_firewall_log";?>
<option value="image_ISO"><?echo "$l_system_iso";?>
</select>
<input type=submit value="<?echo "$l_execute";?>">
</FORM>
<?echo "$l_warning";?>
</td></tr>
</TABLE>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th><?echo "$l_backup_files";?></th></tr>
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
</TABLE>
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
<TR align="center">
<TD><b><?echo "$l_firewall_log";?></b></TD>
<TD><b><?echo "$l_users_db_files";?></b></TD>
<TD><b><?echo "$l_iso_files";?></b></TD>
</TR><TR align="center">
<?
if (isset($_POST['choix'])){
switch ($_POST['choix']){
case 'sauvegarde_DB' :
exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
break;
case 'archivage_logs' :
exec ("sudo /usr/local/bin/alcasar-log-export.sh -30");
break;
case 'image_ISO' :
exec ("sudo /usr/local/bin/alcasar-mondo.sh");
break;
}
}
$dir[0]="logs/firewall";
$dir[1]="base";
$dir[2]="ISO";
$j=0;
$nb=count($dir);
while ($j != $nb)
{
echo "<TD>";
$rep = opendir("/var/Save/".$dir[$j]);
$i=0; unset ($liste_f);
while ( $file = readdir($rep) )
{
if ($file != '.' && $file != '..')
{
$liste_f[$i] = $file;
$i++;
}
}
closedir($rep);
if ($i == 0)
{
echo "vide";
}
else
{
sort($liste_f);
while ( $i > 0)
{
$i--;
echo "<a href=\"/save/$dir[$j]/$liste_f[$i]\">$liste_f[$i]</A> (";echo taille_fichier("/var/Save/".$dir[$j]."/".$liste_f[$i]);echo ")<BR>";
}
}
echo "</TD>";
$j++;
}
?>
</tr>
</TABLE>
</BODY>
</HTML>