Alternc  latest
Alternc logiel libre pour l'hébergement
ftp_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  * Ask for confirmation or delete an FTP account
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 
28 reset($_POST);
29 $lst_todel=array();
30 while (list($key,$val)=each($_POST)) {
31  if (substr($key,0,4)=="del_") {
32  $lst_todel[]=$val;
33  }
34 }
35 
36 if (empty($lst_todel)) {
37  header ("Location: /ftp_list.php");
38  exit();
39 }
40 
41 $fields = array (
42  "confirm_del" => array ("post", "string", ""),
43  "names" => array ("post", "array", ""),
44 );
46 
47 
48 if(!empty($confirm_del)) {
49  foreach($lst_todel as $v) {
50  $r=$ftp->delete_ftp($v);
51  if ($r) {
52  $msg->raise("INFO", "ftp", _("The FTP account %s has been successfully deleted"),$r);
53  }
54  }
55  include("ftp_list.php");
56  exit();
57 } else {
58  include_once('head.php');
59 ?>
60 <h3><?php __("Confirm the FTP accounts deletion"); ?></h3>
61 <hr id="topbar"/>
62 <br />
63  <?php __("Do you really want to delete those accounts?");?>
64  <ul>
65  <?php foreach($lst_todel as $t) {
66  echo "<li><b>".$names[$t]."</b></li>\n";
67  } ?>
68  </ul>
69 
70  <form method="post" action="ftp_del.php" name="main" id="main">
71  <?php csrf_get(); ?>
72  <?php foreach($lst_todel as $t) {
73  echo '<input type="hidden" name="del_'.ehe($t,false).'" value="'.ehe($t,false).'" >'."\n";
74  } ?>
75  <input type="submit" class="inb" name="confirm_del" value="<?php __("Delete")?>" />
76  <input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='ftp_list.php'" />
77  </form>
78 
79 <?php
80  include_once('foot.php');
81  exit();
82 }
83 
84 ?>
exit
Definition: adm_doadd.php:70
$msg
Definition: bootstrap.php:75
$r
Definition: aws_add.php:75
$lst_todel
Definition: ftp_del.php:29
while(list($key, $val)=each($_POST)) if(empty($lst_todel)) $fields
Definition: ftp_del.php:41
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
foreach($domaines_user as $domaine) $t
$val
Definition: tempovars.php:15
if(empty($_POST['key'])||empty($_POST['val'])) $key
Definition: tempovars.php:14