Alternc  latest
Alternc logiel libre pour l'hébergement
sql_restore.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Restore a MySQL database for an account
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26  require_once("../class/config.php");
27 include_once("head.php");
28 
29 $fields = array (
30  "id" => array ("request", "string", ""),
31  "filename" => array ("post", "string", ""),
32 );
34 
35 $r=$mysql->get_mysql_details($id);
36 
37 ?>
38 <h3><?php __("MySQL Databases"); ?></h3>
39 <hr id="topbar"/>
40 <br />
41 <?php
42 echo $msg->msg_html_all();
43 
44 if (!is_array($r)) {
45  echo "<p>"._("You currently have no database defined")."</p>";
46  include_once("foot.php");
47  exit;
48 }
49 ?>
50 <h3 class="restore"><?php printf(_("Restore a MySQL backup for database %s"),$r["db"]); ?></h3>
51 <?php
52 echo "<p>";
53 __("Warning: Write the complete path and the filename. <br />For example if your backups are in the directory /Backups,<br />write /Backups/file.sql.gz (where file.sql.gz is the filename).");
54 echo "</p>";
55 ?>
56 <form action="sql_dorestore.php" method="post">
57  <?php csrf_get(); ?>
58 <input type="hidden" name="id" value="<?php ehe($id); ?>" />
59 <p><label for="restfile"><?php __("Please enter the path and the filename containing SQL data to be restored."); ?></label></p>
60 <p><input type="text" class="int" id="restfile" name="restfile" size="35" maxlength="255" value="<?php ehe($filename); ?>" /> <input class="inb" type="submit" name="submit" onClick='return restfilenotempty();' value="<?php __("Restore my database"); ?>" /><i>
61 <br /><?php __("Tip: you can restore a file directly in the File Browser");?></i></p>
62 </form>
63 <script type="text/javascript">
64  function restfilenotempty() {
65  if ( $('#restfile').val() == '' ) {
66  alert("<?php __("Please the complete path of the filename");?>");
67  return false;
68  } else {
69  return true;
70  }
71  }
72 </script>
73 <?php
74 echo "<p>";
75 __("Note: If the filename ends with .gz, it will be uncompressed before.");
76 echo "</p>";
77 ?>
78 <?php include_once("foot.php"); ?>
exit
Definition: adm_doadd.php:70
$msg
Definition: bootstrap.php:75
__($str)
Definition: functions.php:404
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
Definition: functions.php:1159
$r
Definition: sql_restore.php:35
$fields
Restore a MySQL database for an account.
Definition: sql_restore.php:29
if(!isset($is_include)) if(! $key &&! $crt) $id