Esempio n. 1
0
if (!empty($_POST)) {
    if ($text->is_missing_required) {
        $baddata = true;
    }
    // if there was good submitted data...
    if ($clean['password'] != $clean['confirm-password']) {
        $baddata = true;
        $problems[] = $l['reg-badpassword'];
    }
    // valid email?
    if (!pear_check_email($clean['email'])) {
        $baddata = true;
        $problems[] = $l['reg-bademail'];
    }
    // check if username exists
    if ($user->userExists($clean['username'])) {
        $baddata = true;
        $problems[] = $l['reg-badusername'];
    }
    // email in use?
    $echeck = $db->getArray("SELECT count(*) as c FROM " . db_users . " WHERE email = '" . slash_if_needed($clean['email']) . "';");
    if ($echeck['c'] >= 1) {
        $baddata = true;
        $problems[] = $l['reg-usedemail'];
    }
    // see if template files exist & we have access to them.
    if (!nlb_user::templateExists($clean['template'])) {
        $baddata = true;
        $problems[] = $l['reg-badtemplatechoice'];
    }
    if (!$baddata) {
Esempio n. 2
0
     // we are already loged in.
 }
 $text = new text($_POST, array('username', 'password'));
 $text->validate();
 $text->makeClean('slash_if_needed', 'trim');
 $clean = $text->clean;
 $errors = array();
 $baddata = false;
 if (!empty($_POST)) {
     // data was submitted, check to see if it's good
     $clean = $text->clean;
     if ($text->is_missing_required) {
         $baddata = true;
     }
     // username exists?
     if (!$baddata && !$user->userExists($clean['username'])) {
         $baddata = true;
         $errors[] = $l['log-bad-user'];
     }
     // password works for username?
     if (!$baddata && !$user->checkPass($clean['password'], $clean['username'])) {
         $baddata = true;
         $errors[] = $l['log-bad-pass'];
     }
     // login user?
     if (!$baddata) {
         $user->setIdByName($clean['username']);
         if ($user->get('valid') == 1) {
             // user is valid
             $user->login($config->get('login_time'));
             $ets->page_body = $l['log-good'];