Alternc  latest
Alternc logiel libre pour l'hébergement
sql_del.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  * Delete MySQL databases for the 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  "confirm" => array ("post", "string", ""),
31 );
33 
34 // DO IT
35 if ($confirm=="y" ) {
36  reset($_POST);
37  while (list($key,$val)=each($_POST)) {
38  if (substr($key,0,4)=="del_") {
39  // Effacement de la base $val
40  $r=$mysql->del_db(substr($key,4));
41  if ($r) {
42  $msg->raise("INFO", "mysql", _("The database '%s' has been successfully deleted"), $val);
43  }
44  }
45  }
46  include("sql_list.php");
47  exit();
48 }
49 
50 // Confirm form
51 $found=false;
52 foreach($_POST as $key=>$val) {
53  if (substr($key,0,4)=="del_") {
54  $found=true;
55  }
56 }
57 if (!$found) {
58  $msg->raise("ALERT", "mysql", _("Please check which databases you want to delete"));
59  include("sql_list.php");
60  exit();
61  }
62 
63 ?>
64 <h3><?php __("MySQL Databases"); ?></h3>
65 <hr id="topbar"/>
66 <br />
67 <p class="alert alert-warning"><?php __("WARNING"); ?></big><br /><?php __("Confirm the deletion of the following SQL databases"); ?><br />
68 <?php __("This will delete all the tables currently in those db."); ?></p>
69 <form method="post" action="sql_del.php" id="main">
70  <?php csrf_get(); ?>
71 <p>
72 <input type="hidden" name="confirm" value="y" />
73 <?php
74 reset($_POST);
75 while (list($key,$val)=each($_POST)) {
76  if (substr($key,0,4)=="del_") {
77  echo "<input type=\"hidden\" name=\"".ehe($key,false)."\" value=\"".ehe($val,false)."\" /><ul><li><b>".ehe($val,false)."</b></li></ul>\n";
78  }
79 }
80 
81 ?>
82 <br />
83 <input type="submit" class="inb ok" name="sub" value="<?php __("Yes, delete the database"); ?>" /> <input type="button" class="inb cancel" name="non" value="<?php __("No, don't delete the database"); ?>" onclick="history.back()" />
84 </p>
85 </form>
86 <?php include_once("foot.php"); ?>
exit
Definition: adm_doadd.php:70
$msg
Definition: bootstrap.php:75
$r
Definition: aws_add.php:75
ehe($str, $display=TRUE)
Echo the HTMLSpecialChars version of a value.
Definition: functions.php:647
__($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
$fields
Delete MySQL databases for the account.
Definition: sql_del.php:29
if($confirm=="y") $found
Definition: sql_del.php:51
$val
Definition: tempovars.php:15
if(empty($_POST['key'])||empty($_POST['val'])) $key
Definition: tempovars.php:14