0337d704 |
1 | <?php |
2 | require 'xnet.inc.php'; |
3 | |
4 | new_groupadmin_page('xnet/groupe/alias-create.tpl'); |
5 | |
6 | if(Post::has('submit')) { |
7 | if (!Post::has('liste')) { |
8 | $page->trig_run('champs «addresse souhaitée» vide'); |
9 | } |
10 | $liste = Post::get('liste'); |
11 | if (!preg_match("/^[a-zA-Z0-9\-]*$/", $liste)) { |
12 | $page->trig_run('le nom de l\'alias ne doit contenir que des lettres, chiffres et tirets'); |
13 | } |
14 | |
15 | $new = $liste.'@'.$globals->asso('mail_domain'); |
16 | $res = $globals->xdb->query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new); |
17 | $n = $res->fetchOneCell(); |
18 | if($n) { |
19 | $page->trig_run('cet alias est déjà pris'); |
20 | } |
21 | |
22 | $globals->xdb->query('INSERT INTO x4dat.virtual (alias,type) VALUES({?}, "user")', $new); |
23 | header("Location: alias-admin.php?liste=$new"); |
24 | } |
25 | |
26 | $page->run(); |
27 | |
28 | ?> |