Location: PHPKode > projects > Soraxdesign PHP Guestbook > admin/settings_main.backup.inc.php
<?php
if($session_id==$sess_id and $session_id!="" and $sess_id!="")
{
	if($do=="")
	{
	$_SESSION['backupVorschau']=1;
	
	
	$subdir=opendir("../Data/Backups/");
	$backupsarray=array();
		while($file=readdir($subdir))
		{
			if($file!="." and $file!="..")
			{
			array_push($backupsarray,$file);
			}
		}
	rsort($backupsarray,SORT_NUMERIC);
	?>
	<div id="grundeinstellungen" style="position:absolute;width:800px;margin:0px;overflow:auto;height:407px">
	<form name="form1" method="post" action="admin.php?action=login&go=1&session_id=<?php echo $sess_id ?>&show=backup&do=create_backup" style="margin:0px;padding:0px" enctype="multipart/form-data">
	<?php
	if(count($backupsarray)>0)
	{
	$a=0;
		foreach($backupsarray as $backups)
		{
		$daten=explode(".",$backups);
		$datum=date("d.m.Y - H:i", $daten[0]);
		$border="";
			if(filesize("../Data/gb.txt")==filesize("../Data/Backups/$backups"))
			{
			$border=red;
			?>
			<div class="titeldiv" style="background-color:FFFFFF;border:1px solid red">
			<b><font color="red"><?php echo $sprache[107] ?></font></b>
			</div>
			<?php
			}
		?>
		<div class="titeldiv" style="border-color:<?php echo $border ?>">
			<div class="backup_uebersicht_links">
			<b><?php echo $sprache[104] ?></b> &nbsp &nbsp <?php echo $datum ?> 
			</div>
			<div class="backup_uebersicht_links">
			<b><?php echo $sprache[105] ?></b> &nbsp &nbsp <?php echo round(filesize("../Data/Backups/$backups")/100,2)." KB" ?>
			</div>
			<div class="backup_uebersicht_rechts">
			<a href="../<?php echo $inhalt[62] ?>?datenbank=<?php echo $backups ?>" target="_blank"><img Title="<?php echo $sprache[103] ?>" Alt="<?php echo $sprache[103] ?>" src="images/images/einstellungen/magnifier.gif" border="0"></a> <a href="admin.php?action=login&go=1&show=backup&do=set_backup&session_id=<?php echo $sess_id ?>&backup_id=<?php echo $backups ?>"><img Title="<?php echo $sprache[100] ?>" Alt="<?php echo $sprache[100] ?>" src="images/images/einstellungen/table_refresh.gif" border="0"></a> <a href="admin.php?action=login&go=1&show=backup&do=delete_backup&session_id=<?php echo $sess_id ?>&backup_id=<?php echo $backups ?>"><img Title="<?php echo $sprache[99] ?>" Alt="<?php echo $sprache[99] ?>" src="images/images/einstellungen/database_delete.gif" border="0"></a>
			</div>
		</div>
		<?php
		$a++;
		}
		echo"<br><br>";
	}
	else
	{
		echo"<br><br><center><b>$sprache[101]</b></center>";
	}
	?>
	</div>
	<div id="menu_unten" style="position:absolute;margin-top:407px;width:800px;height:25px;background-image:url('images/symbolleisten/menu_back_unten.jpg')">
		<div style="float:left;height:25px;background-image:url('images/symbolleisten/menu_back_unten_button.jpg');border-right:1px solid #83ACCA">
			<div style="margin-left:10px;margin-top:7px;margin-right:10px">
			<a href="admin.php?action=login&go=1&session_id=<?php echo $session_id ?>" class="menu"><?php echo $sprache[95] ?></a>
			</div>
		</div>
		<div style="float:right;height:25px;background-image:url('images/symbolleisten/menu_back_unten_button.jpg');border-left:1px solid #83ACCA">
			<div style="margin-left:10px;margin-top:7px;margin-right:10px">
			<a href="admin.php?action=login&go=1&show=backup&do=create_backup&session_id=<?php echo $session_id ?>" class="menu"><?php echo $sprache[98] ?></a>
			</div>
		</div>
	</div>
	</form>
	<?php
	}
	
	
	if($do=="create_backup")
	{
		if(file_exists("../Data/gb.txt"))
		{
		$time=time();
		copy("../Data/gb.txt","../Data/Backups/$time.dat");
		echo"
		<br><br>
		<center>
		<font color=\"#2F9A1E\"><b>$sprache[102]<br><br><a href=\"admin.php?go=1&session_id=$sess_id&action=login&show=backup\" class=\"links\">$sprache[95]</a></b></font>
		</center>";
		}
	}
	
	if($do=="set_backup")
	{
	$backup_id=$_GET['backup_id'];
		if(file_exists("../Data/Backups/$backup_id"))
		{
			if(file_exists("../Data/gb.txt"))
			{
			unlink("../Data/gb.txt");
			}
		copy("../Data/Backups/$backup_id","../Data/gb.txt");
		echo"
		<br><br>
		<center>
		<font color=\"#2F9A1E\"><b>$sprache[106]<br><br><a href=\"admin.php?go=1&session_id=$sess_id&action=login&show=backup\" class=\"links\">$sprache[95]</a></b></font>
		</center>";
		}
	}
	
	if($do=="delete_backup")
	{
	$backup_id=$_GET['backup_id'];
		if(file_exists("../Data/Backups/$backup_id"))
		{
		unlink("../Data/Backups/$backup_id");
		echo"
		<br><br>
		<center>
		<font color=\"#2F9A1E\"><b>$sprache[108]<br><br><a href=\"admin.php?go=1&session_id=$sess_id&action=login&show=backup\" class=\"links\">$sprache[95]</a></b></font>
		</center>";
		}
	}
}
else
{
echo"<meta http-equiv=\"refresh\" content=\"0; URL=error.php\" target=\"_top\">";
}
?>
Return current item: Soraxdesign PHP Guestbook