Location: PHPKode > projects > Fretsweb > fretsweb-1.2/fretsweb/admin/backuphandle.php
<?php

/*
Fretsweb - A Frets on Fire chart server
Copyright (C) 2009  Daan Sprenkels

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

include_once "backup.php";
require_once "../config.php";

//Login Test
session_start();
if($_SESSION['in'] < 2)
{
	header('location: login.php?need=admin');
	die();
}

$db_link = mysql_connect($db_host, $db_user, $db_passwd);
mysql_select_db($db_name, $db_link);


if(isset($_POST['sql']))
	$info = '<p class="info">'.use_sql($_POST['sql_area']).'</p>';
elseif(isset($_POST['create']))
	$info = create_backup();
elseif(isset($_POST['createdown']))
	$info = create_backup(true);
elseif(isset($_POST['use']))
	if(isset($_POST['useradio']))
		$info = '<p class="info">'.use_backup($_POST['useradio']).'</p>';
	else
		$info = '<p class="info">First choose a backup!</p>';

require_once "common.php";

?><html>
 <head>
  <title>Database Backuping</title>
  <link href="../css.php" rel="stylesheet" type="text/css" />
  <link href="../images/favicon.png" rel="icon">
 </head>
 <body><center>
  <h2>Database Backup</h2>
  <? if(isset($info)) echo "<p class=\"info\">$info</p>"; ?>
  <p>Note: This works only if you have writing permissions... Otherwise, save them manually.</p>
  <p>Another note: I recommend writing a backup before using another.</p>
  <h3>Storing backups</h3>
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  <p>
  <?php list_backups(); ?><br/>
  </p>
  <p>
   <input type="submit" name="use" value="Use backup">
   <input type="submit" name="create" value="Write backup">
   <input type="submit" name="createdown" value="Write and download backup">
  </p>
  </form>
  <h3>Manual backups</h3>
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  <p>
   <textarea cols="64" rows="16" name="sql_area"></textarea>
  </p>
  <p>
   <input type="submit" name="sql" value="Use SQL">
  </p>
  </form>
  <p><b><a href="index.php">Back to main administration panel</a></b><p>
 </center></body>
</html>
<?php

mysql_close($db_link);

?>
Return current item: Fretsweb