Alternc  latest
Alternc logiel libre pour l'hébergement
adm_add.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  * Form to add a new account to AlternC
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 include_once("head.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  "canpass" => array ("post", "integer", 1),
37  "login" => array ("post", "string", null),
38  "pass" => array ("post", "string", null),
39  "passconf" => array ("post", "string", null),
40  "notes" => array ("post", "string", null),
41  "nom" => array ("post", "string", null),
42  "prenom" => array ("post", "string", null),
43  "nmail" => array ("post", "string", null),
44  "create_dom" => array ("post", "integer", 0),
45 );
47 
48 $c=$admin->listPasswordPolicies();
49 $passwd_classcount = $c['adm']['classcount'];
50 
51 ?>
52 <h3><?php __("New AlternC account"); ?></h3>
53 <hr id="topbar"/>
54 <br />
55 <?php
56 echo $msg->msg_html_all();
57 ?>
58 <form method="post" action="adm_doadd.php" id="main" name="main" autocomplete="off">
59  <?php csrf_get(); ?>
60 
61 <table class="tedit">
62 <tr><th><label for="login"><?php __("Username"); ?></label><span class="mandatory">*</span></th><td>
63  <input type="text" class="int" name="login" id="login" autocomplete="off" value="<?php ehe($login); ?>" size="20" maxlength="16" />
64 </td></tr>
65 <tr>
66  <th><label for="pass"><?php __("Initial password"); ?></label><span class="mandatory">*</span></th>
67  <td><input type="password" id="pass" name="pass" autocomplete="off" class="int" value="<?php ehe($pass); ?>" size="20" maxlength="64" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#pass","#passconf",$passwd_classcount); ?></td>
68 </tr>
69 <tr>
70  <th><label for="passconf"><?php __("Confirm password"); ?></label><span class="mandatory">*</span></th>
71  <td><input type="password" id="passconf" name="passconf" autocomplete="off" class="int" value="<?php ehe($passconf); ?>" size="20" maxlength="64" /></td>
72 </tr>
73 <tr>
74  <th><label><?php __("Can he change its password"); ?></label></th>
75  <td>
76  <input type="radio" class="inc" id="canpass0" name="canpass" value="0"<?php cbox($canpass==0); ?>/><label for="canpass0"><?php __("No"); ?></label><br />
77  <input type="radio" class="inc" id="canpass1" name="canpass" value="1"<?php cbox($canpass==1); ?>/><label for="canpass1"><?php __("Yes"); ?></label><br />
78  </td>
79 </tr>
80 <tr>
81  <th><label for="notes"><?php __("Notes"); ?></label></th>
82  <td><textarea name="notes" id="notes" class="int" cols="32" rows="5"><?php ehe($notes); ?></textarea></td>
83 </tr>
84 <tr>
85  <th><label for="nom"><?php echo _("Surname")."</label> / <label for=\"prenom\">"._("First Name"); ?></label></th>
86  <td><input class="int" type="text" id="nom" name="nom" value="<?php ehe($nom); ?>" size="16" maxlength="128" />&nbsp;/&nbsp;<input type="text" name="prenom" id="prenom" value="<?php ehe($prenom); ?>" class="int" size="16" maxlength="128" /></td>
87 </tr>
88 <tr>
89  <th><label for="nmail"><?php __("Email address"); ?></label><span class="mandatory">*</span></th>
90  <td><input type="text" name="nmail" id="nmail" class="int" value="<?php ehe($nmail); ?>" size="30" maxlength="128" /></td>
91 </tr>
92 <tr>
93  <th><label for="type"><?php __("Account type"); ?></label></th>
94  <td><select name="type" id="type" class="inl">
95  <?php
96  eoption($quota->listtype(), 'default', true);
97 ?></select>
98 </td>
99 </tr>
100 <tr>
101  <th>
102  <?php
103  __("Associate this new user to this database server:");
104  echo "<br/>";
105  echo "<i>"._("Warning: you can't change it after the creation of the user.")."</i>";
106  ?>
107  </th>
108  <td><?php
109  echo "<select name='db_server_id' id='db_server_id' >";
110  foreach ($mysql->list_db_servers() as $ldb ) {
111  echo "<option value='".$ldb['id']."'>".$ldb['name']."</option>";
112  }
113  echo "</select>";
114  ?>
115  </td>
116 </tr>
117 
118 <?php if (variable_get('hosting_tld') || $dom->enum_domains()) { ?>
119 <tr>
120  <th colspan="2">
121  <input type="checkbox" name="create_dom" value="1" class="inc" id="create_dom" <?php cbox($create_dom==1); ?>/>
122  <label for="create_dom"><?php printf(_("Install the domain"),""); ?></label>
123  <span class="int" id="create_dom_list_pfx">login.</span><select name="create_dom_list" class="int" id="create_dom_list">
124  <?php if (variable_get('hosting_tld')) { ?>
125  <option value="<?php echo variable_get('hosting_tld'); ?>" selected="selected"><?php echo variable_get('hosting_tld'); ?></option>
126  <?php }
127  /* Enumeration des domaines : */
128  $domain=$dom->enum_domains();
129  reset($domain);
130  while (list($key,$val)=each($domain)) { ?>
131  <option value="<?php echo $val; ?>" > <?php echo $val?> </option>
132  <?php } ?>
133  </select>
134  </th>
135 </tr>
136  <?php } ?>
137 <tr class="trbtn"><td colspan="2">
138  <input type="submit" class="inb ok" name="submit" value="<?php __("Create this AlternC account"); ?>" />
139  <input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='adm_list.php'" />
140 </td></tr>
141 </table>
142 </form>
143 <script type="text/javascript">
144  document.forms['main'].login.focus();
145 </script>
146 
147 <?php include_once("foot.php"); ?>
if(! $admin->enabled) $fields
Form to add a new account to AlternC.
Definition: adm_add.php:35
$c
Definition: adm_add.php:48
$passwd_classcount
Definition: adm_add.php:49
exit
Definition: adm_doadd.php:70
$msg
Definition: bootstrap.php:75
variable_get($name, $default=null, $createit_comment=null)
Return a persistent variable.
Definition: variables.php:85
const DEFAULT_PASS_SIZE
Define constants from vars of /etc/alternc/local.sh The you can't choose where is the AlternC Panel.
Definition: config.php:81
$domain
Definition: dom_import.php:36
display_div_generate_password($pass_size=DEFAULT_PASS_SIZE, $fields_to_fill1="", $fields_to_fill2="", $classcount=3)
Show a button to set a random password for a password field.
Definition: functions.php:922
eoption($values, $cur, $onedim=false)
select_values($arr,$cur) echo des <option> du tableau $values ou de la table sql $values selectionne ...
Definition: functions.php:619
ehe($str, $display=TRUE)
Echo the HTMLSpecialChars version of a value.
Definition: functions.php:647
selected($bool, $echo=TRUE)
ECHOes selected="selected" only if the parameter is true useful for checkboxes and radio buttons.
Definition: functions.php:366
__($str)
Definition: functions.php:404
cbox($test, $echo=true)
ECHOes checked="checked" only if the parameter is true useful for checkboxes and radio buttons.
Definition: functions.php:345
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
$dom
Definition: whois_test.php:10