Alternc  latest
Alternc logiel libre pour l'hébergement
adm_dodel.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 one or more AlternC's accounts
22  * of course, confirm the deletion
23  *
24  * @copyright AlternC-Team 2000-2017 https://alternc.com/
25  */
26 
27 require_once("../class/config.php");
28 
29 if (!$admin->enabled) {
30  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
31  echo $msg->msg_html_all();
32  exit();
33 }
34 
35 $fields = array (
36  "accountList" => array ("post", "array", array()),
37  "del_confirm" => array("post", "string", ""),
38 );
40 
41 if($del_confirm == "y"){
42  foreach ($accountList as $key => $val) {
43  if (!$admin->checkcreator($val)) {
44  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
45  echo $msg->msg_html_all();
46  exit();
47  }
48  if (!($u=$admin->get($val)) || !$admin->del_mem($val)) {
49  $msg->raise("ERROR", "admin", _("Member '%s' does not exist"),$val);
50  } else {
51  $msg->raise("INFO", "admin", _("Member %s successfully deleted"),$u["login"]);
52  }
53  }
54  include("adm_list.php");
55  exit();
56 } else {
57  if (!is_array($accountList) || count($accountList)==0) {
58  $msg->raise("ERROR", "admin", _("Please check the accounts you want to delete"));
59  require("adm_list.php");
60  exit();
61  }
62  include("head.php");
63  ?>
64  </head>
65  <body>
66  <h3><?php printf(_("Deleting users")); ?> : </h3>
67  <form action="adm_dodel.php" method="post">
68  <?php csrf_get(); ?>
69  <input type="hidden" name="action" value="delete" />
70  <input type="hidden" name="del_confirm" value="y" />
71  <p class="alert alert-warning"><?php __("WARNING : Confirm the deletion of the users"); ?></p>
72  <p>
73  <ul>
74  <?php
75  foreach($accountList as $userid){
76  $membre = $admin->get($userid);
77  echo "<li><input type=\"hidden\" name=\"accountList[]\" value=\"$userid\" />".$membre['login']."</li>";
78  }
79  ?>
80  </ul>
81  </p>
82  <blockquote>
83  <input type="submit" class="inb ok" name="confirm" value="<?php __("Yes, delete those accounts"); ?>" />&nbsp;&nbsp;
84  <input type="button" class="inb cancel" name="cancel" value="<?php __("No, don't delete those accounts"); ?>" onclick="document.location='adm_list.php';" />
85  </blockquote>
86  </form>
87  <?php
88  include('foot.php');
89 }
90 
91 ?>
exit
Definition: adm_doadd.php:70
if(! $admin->enabled) $fields
Delete one or more AlternC's accounts of course, confirm the deletion.
Definition: adm_dodel.php:35
$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
$val
Definition: tempovars.php:15
if(empty($_POST['key'])||empty($_POST['val'])) $key
Definition: tempovars.php:14