Alternc  latest
Alternc logiel libre pour l'hébergement
adm_doadd.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  * Validate and create a new account
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 
28 if (!$admin->enabled) {
29  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
30  echo $msg->msg_html_all();
31  exit;
32 }
33 $fields = array (
34  "login" => array ("post", "string", ""),
35  "pass" => array ("post", "string", ""),
36  "passconf" => array ("post", "string", ""),
37  "canpass" => array ("post", "integer", ""),
38  "db_server_id" => array ("post", "integer", ""),
39  "notes" => array ("post", "string", ""),
40  "nom" => array ("post", "string", ""),
41  "prenom" => array ("post", "string", ""),
42  "nmail" => array ("post", "string", ""),
43  "type" => array ("post", "string", ""),
44  "create_dom_list" => array ("post", "string", ""),
45  "create_dom" => array ("post", "integer", 0),
46  "submit" => array ("post", "string", ""),
47 );
49 
50 if ($create_dom && !empty($create_dom_list) ) {
51  $dom_to_create = $create_dom_list;
52 } else {
53  $dom_to_create = false;
54 }
55 
56 if ($pass != $passconf) {
57  $msg->raise("ERROR", "admin", _("Passwords do not match"));
58  include("adm_add.php");
59  exit();
60 }
61 
62 // Attemp to create, exit if fail
63 if (!($u=$admin->add_mem($login, $pass, $nom, $prenom, $nmail, $canpass, $type, 0, $notes, 0, $dom_to_create, $db_server_id))) {
64  include ("adm_add.php");
65  exit;
66 }
67 
68 $msg->raise("INFO", "admin", _("The new member has been successfully created"));
69 
70 include("adm_list.php");
72 
73 ?>
exit
Definition: adm_doadd.php:70
if(! $admin->enabled) $fields
Validate and create a new account.
Definition: adm_doadd.php:33
$msg
Definition: bootstrap.php:75
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
$login