354 |
richard |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
2 |
<HTML><!-- written by Rexy -->
|
|
|
3 |
<HEAD>
|
|
|
4 |
<TITLE>Sauvegarde</TITLE>
|
|
|
5 |
<link rel="stylesheet" href="/css/style.css" type="text/css">
|
|
|
6 |
</HEAD>
|
|
|
7 |
<body>
|
|
|
8 |
<?
|
|
|
9 |
# choice of language
|
|
|
10 |
$Language = "en";
|
|
|
11 |
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
|
|
12 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
13 |
$Language = strtolower(substr(chop($Langue[0]),0,2));}
|
|
|
14 |
if ($Language == 'fr'){
|
|
|
15 |
$l_backups = "Sauvegarde";
|
|
|
16 |
$l_user_db_save = "Sauvegarder la base des usagers";
|
|
|
17 |
$l_system_iso = "Créer une image ISO à chaud du système";
|
|
|
18 |
$l_execute = "Exécuter";
|
|
|
19 |
$l_warning = "(attention, la création de l'image ISO du système dure plusieurs dizaines de minutes)";
|
|
|
20 |
$l_backup_files = "Fichiers disponibles pour archivage";
|
|
|
21 |
$l_firewall_log = "Journaux du parefeu (Firewall)";
|
|
|
22 |
$l_users_db_files = "Base des usagers";
|
|
|
23 |
$l_iso_files = "images ISO du système";
|
|
|
24 |
}
|
|
|
25 |
else {
|
|
|
26 |
$l_backups = "Backups";
|
|
|
27 |
$l_user_db_save = "Save the users database";
|
|
|
28 |
$l_system_iso = "Create a system iso image";
|
|
|
29 |
$l_execute = "Execute";
|
|
|
30 |
$l_warning = "(warning, the creation of the system iso image takes few minutes)";
|
|
|
31 |
$l_backup_files = "Archive backup files";
|
|
|
32 |
$l_firewall_log = "Firewall log files";
|
|
|
33 |
$l_users_db_files = "Users database";
|
|
|
34 |
$l_iso_files = "System ISO images";
|
|
|
35 |
}
|
|
|
36 |
function taille_fichier($fichier)
|
|
|
37 |
{
|
|
|
38 |
$taille_fichier = filesize($fichier);
|
|
|
39 |
if ($taille_fichier >= 1073741824){
|
|
|
40 |
$taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";}
|
|
|
41 |
elseif ($taille_fichier >= 1048576){
|
|
|
42 |
$taille_fichier = round($taille_fichier / 1048576 * 100) / 100 . " Mo";}
|
|
|
43 |
elseif ($taille_fichier >= 1024){
|
|
|
44 |
$taille_fichier = round($taille_fichier / 1024 * 100) / 100 . " Ko";}
|
|
|
45 |
else {$taille_fichier = $taille_fichier . " o";}
|
|
|
46 |
return $taille_fichier;
|
|
|
47 |
}
|
|
|
48 |
?>
|
|
|
49 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
50 |
<tr><th><? echo $l_backups;?></th></tr>
|
|
|
51 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
52 |
</TABLE>
|
|
|
53 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
54 |
<tr><td valign="middle" align="left">
|
|
|
55 |
<FORM action="sauvegarde.php" method=POST><b>
|
|
|
56 |
<select name='choix'></b>
|
|
|
57 |
<option value="sauvegarde_DB"><?echo "$l_user_db_save";?>
|
|
|
58 |
<option value="archivage_logs"><?echo "$l_firewall_log";?>
|
|
|
59 |
<option value="image_ISO"><?echo "$l_system_iso";?>
|
|
|
60 |
</select>
|
|
|
61 |
<input type=submit value="<?echo "$l_execute";?>">
|
|
|
62 |
</FORM>
|
|
|
63 |
<?echo "$l_warning";?>
|
|
|
64 |
</td></tr>
|
|
|
65 |
</TABLE>
|
|
|
66 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
67 |
<tr><th><?echo "$l_backup_files";?></th></tr>
|
|
|
68 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
69 |
</TABLE>
|
|
|
70 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
71 |
<TR align="center">
|
|
|
72 |
<TD><b><?echo "$l_firewall_log";?></b></TD>
|
|
|
73 |
<TD><b><?echo "$l_users_db_files";?></b></TD>
|
|
|
74 |
<TD><b><?echo "$l_iso_files";?></b></TD>
|
|
|
75 |
</TR><TR align="center">
|
|
|
76 |
<?
|
|
|
77 |
if (isset($_POST['choix'])){
|
|
|
78 |
switch ($_POST['choix']){
|
|
|
79 |
case 'sauvegarde_DB' :
|
|
|
80 |
exec ("sudo /usr/local/sbin/alcasar-mysql.sh -dump");
|
|
|
81 |
break;
|
|
|
82 |
case 'archivage_logs' :
|
|
|
83 |
exec ("sudo /usr/local/bin/alcasar-log-export.sh -30");
|
|
|
84 |
break;
|
|
|
85 |
case 'image_ISO' :
|
|
|
86 |
exec ("sudo /usr/local/bin/alcasar-mondo.sh");
|
|
|
87 |
break;
|
|
|
88 |
}
|
|
|
89 |
}
|
|
|
90 |
$dir[0]="logs/firewall";
|
|
|
91 |
$dir[1]="base";
|
|
|
92 |
$dir[2]="ISO";
|
|
|
93 |
$j=0;
|
|
|
94 |
$nb=count($dir);
|
|
|
95 |
while ($j != $nb)
|
|
|
96 |
{
|
|
|
97 |
echo "<TD>";
|
|
|
98 |
$rep = opendir("/var/Save/".$dir[$j]);
|
|
|
99 |
$i=0; unset ($liste_f);
|
|
|
100 |
while ( $file = readdir($rep) )
|
|
|
101 |
{
|
|
|
102 |
if ($file != '.' && $file != '..')
|
|
|
103 |
{
|
|
|
104 |
$liste_f[$i] = $file;
|
|
|
105 |
$i++;
|
|
|
106 |
}
|
|
|
107 |
}
|
|
|
108 |
closedir($rep);
|
|
|
109 |
if ($i == 0)
|
|
|
110 |
{
|
|
|
111 |
echo "vide";
|
|
|
112 |
}
|
|
|
113 |
else
|
|
|
114 |
{
|
|
|
115 |
sort($liste_f);
|
|
|
116 |
while ( $i > 0)
|
|
|
117 |
{
|
|
|
118 |
$i--;
|
|
|
119 |
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>";
|
|
|
120 |
}
|
|
|
121 |
}
|
|
|
122 |
echo "</TD>";
|
|
|
123 |
$j++;
|
|
|
124 |
}
|
|
|
125 |
?>
|
|
|
126 |
</tr>
|
|
|
127 |
</TABLE>
|
|
|
128 |
</BODY>
|
|
|
129 |
</HTML>
|