Ejemplo n.º 1
0
} else {
    header('Location: newuser.php?msg=spam');
}
if (w2PgetConfig('activate_external_user_creation') != 'true') {
    die('You should not access this file directly');
}
$username = w2PgetParam($_POST, 'user_username', 0);
$username = preg_replace("/[^A-Za-z0-9]/", "", $username);
$user = new CAdmin_User();
$result = $user->loadAll(null, "user_username = '******'");
if (count($result)) {
    header('Location: newuser.php?msg=existing-user');
}
$email = w2PgetParam($_POST, 'contact_email', 0);
$contact = new CContact();
$result = $contact->loadAll(null, "contact_email = '{$email}'");
if (count($result)) {
    header('Location: newuser.php?msg=existing-email');
}
if (!$user->bind($_POST)) {
    $AppUI->setMsg($user->getError(), UI_MSG_ERROR);
    header('Location: newuser.php?msg=user');
}
if (!$contact->bind($_POST)) {
    $AppUI->setMsg($contact->getError(), UI_MSG_ERROR);
    header('Location: newuser.php?msg=contact');
}
$result = $contact->store();
if (count($contact->getError())) {
    header('Location: newuser.php?msg=contact');
} else {