-
Notifications
You must be signed in to change notification settings - Fork 3
/
adminfailaddsubmit.php
32 lines (29 loc) · 1.05 KB
/
adminfailaddsubmit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
include_once dirname(__FILE__) . '/config/variables.php';
include_once dirname(__FILE__) . '/config/authpostmaster.php';
include_once dirname(__FILE__) . '/config/functions.php';
include_once dirname(__FILE__) . '/config/httpheaders.php';
check_user_exists(
$db,$_POST['localpart'],$_SESSION['domain_id'],'adminfail.php'
);
if (preg_match("/['@%!\/\| ']/",$_POST['localpart'])) {
header("Location: adminfail.php?badname={$_POST['localpart']}");
die;
}
$query = "INSERT INTO users (localpart, username, domain_id, smtp, pop,
uid, gid, type, realname) SELECT '{$_POST['localpart']}',
'{$_POST['localpart']}@{$_SESSION['domain']}',
'{$_SESSION['domain_id']}',
':fail:',
':fail:',
uid,
gid,
'fail',
'Fail' FROM domains WHERE domain_id='{$_SESSION['domain_id']}'";
$result = $db->query($query);
if (!DB::isError($result)) {
header ("Location: adminfail.php?added={$_POST['localpart']}");
} else {
header ("Location: adminfail.php?failadded={$_POST['localpart']}");
}
?>