Alternc  latest
Alternc logiel libre pour l'hébergement
sql_users_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 a MySQL user account
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 $fields = array (
28  "confirm" => array ("post", "string", ""),
29 );
31 
32 if (isset($confirm) && ($confirm=="y")) {
33  reset($_POST);
34  while (list($key,$val)=each($_POST)) {
35  if (substr($key,0,4)=="del_") {
36  // Effacement de la base $val
37  if($mysql->del_user($val)) {
38  $msg->raise("INFO", "mysql", _("The user '%s' has been successfully deleted"), $val);
39  }
40  }
41  }
42  include("sql_users_list.php");
43  exit();
44 }
45 
46 include_once("head.php");
47 
48 ?>
49 <h3><?php __("MySQL users"); ?></h3>
50 <hr id="topbar"/>
51 <br />
52 <p class="alert alert-warning"><?php __("WARNING"); ?></big><br /><?php __("Confirm the deletion of the following MySQL users"); ?><br />
53 </p>
54 <form method="post" action="sql_users_del.php" id="main">
55  <?php csrf_get(); ?>
56 <p>
57 <input type="hidden" name="confirm" value="y" />
58 <ul>
59 <?php
60 reset($_POST);
61 while (list($key,$val)=each($_POST)) {
62  if (substr($key,0,4)=="del_") {
63  echo "<li><input type=\"hidden\" name=\"".ehe($key,false)."\" value=\"".ehe($val,false)."\" /><b>".ehe($val,false)."</b></li>\n";
64  }
65 }
66 
67 ?>
68 </ul>
69 <input type="submit" class="inb ok" name="sub" value="<?php __("Yes, delete the MySQL user"); ?>" /> <input type="button" class="inb cancel" name="non" value="<?php __("No, don't delete the MySQL user"); ?>" onclick="history.back()" />
70 </p>
71 </form>
72 <?php include_once("foot.php"); ?>
exit
Definition: adm_doadd.php:70
$msg
Definition: bootstrap.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 a MySQL user account.
$val
Definition: tempovars.php:15
if(empty($_POST['key'])||empty($_POST['val'])) $key
Definition: tempovars.php:14