Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
sql_del.php
Go to the documentation of this file.
1 <?php
2 /*
3  $Id: sql_del.php,v 1.3 2003/06/10 07:20:29 root Exp $
4  ----------------------------------------------------------------------
5  AlternC - Web Hosting System
6  Copyright (C) 2002 by the AlternC Development Team.
7  http://alternc.org/
8  ----------------------------------------------------------------------
9  Based on:
10  Valentin Lacambre's web hosting softwares: http://altern.org/
11  ----------------------------------------------------------------------
12  LICENSE
13 
14  This program is free software; you can redistribute it and/or
15  modify it under the terms of the GNU General Public License (GPL)
16  as published by the Free Software Foundation; either version 2
17  of the License, or (at your option) any later version.
18 
19  This program is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  GNU General Public License for more details.
23 
24  To read the license please visit http://www.gnu.org/copyleft/gpl.html
25  ----------------------------------------------------------------------
26  Original Author of file: Benjamin Sonntag
27  Purpose of file: Delete a mysql user database
28  ----------------------------------------------------------------------
29 */
30 require_once("../class/config.php");
31 include_once ("head.php");
32 
33 $fields = array (
34  "confirm" => array ("post", "string", ""),
35 );
37 
38 if(!isset($error)){
39  $error="";
40 }
41 
42 if ($confirm=="y" ) {
43  reset($_POST);
44  while (list($key,$val)=each($_POST)) {
45  if (substr($key,0,4)=="del_") {
46  // Effacement de la base $val
47  $r=$mysql->del_db(substr($key,4));
48  if (!$r) {
49  $error.=$err->errstr()."<br />";
50  } else {
51  $error.=sprintf(_("The database %s has been successfully deleted"),$val)."<br />";
52  }
53  }
54  }
55  include("sql_list.php");
56  exit();
57 }
58 
59 $found=false;
60 foreach($_POST as $key=>$val) {
61  if (substr($key,0,4)=="del_") {
62  $found=true;
63  }
64 }
65 if (!$found) {
66  $error=_("Please check which databases you want to delete");
67  include("sql_list.php");
68  exit();
69  }
70 
71 ?>
72 <h3><?php __("MySQL Databases"); ?></h3>
73 <hr id="topbar"/>
74 <br />
75 <p class="alert alert-warning"><?php __("WARNING"); ?></big><br /><?php __("Confirm the deletion of the following SQL databases"); ?><br />
76 <?php __("This will delete all the tables currently in those db."); ?></p>
77 <form method="post" action="sql_del.php" id="main">
78 <p>
79 <input type="hidden" name="confirm" value="y" />
80 <?php
81 reset($_POST);
82 while (list($key,$val)=each($_POST)) {
83  if (substr($key,0,4)=="del_") {
84  echo "<input type=\"hidden\" name=\"$key\" value=\"$val\" />".$val."<br />\n";
85  }
86 }
87 
88 ?>
89 <br />
90 <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()" />
91 </p>
92 </form>
93 <?php include_once("foot.php"); ?>