Ejemplo n.º 1
0
$text = new Text($_POST, array('username', 'password', 'confirm-password', 'email', 'template', 'timezone'), array('custom'));
$text->validate();
$clean = $text->clean;
$baddata = false;
$problems = array();
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.
Ejemplo n.º 2
0
$ets->page_body = "";
$ets_outter->main_title = $config->get('site_name') . ": " . $l['title-usercp'];
$ets_outter->page_title = $l['title-profile'];
$text = new text($_POST, array('email', 'date_format', 'perpage', 'timezone'), array('custom', 'gender', 'birthday', 'bio'));
$text->validate();
$text->makeClean('slash_if_needed', 'trim');
$baddata = false;
$problems = array();
if (!empty($_POST)) {
    // process data
    if ($text->is_missing_required) {
        $baddata = true;
    }
    $c = $text->clean;
    // good email?
    if (!pear_check_email($c['email'])) {
        $baddata = true;
        $problems[] = $l['reg-bademail'];
    }
    // blogs per page
    if (abs($c['perpage']) == 0) {
        $c['perpage'] = 10;
    }
    // now we can update if nothing went wrong.
    if (!$baddata) {
        // check birthday
        if (empty($c['birthday']) || ($bday = strtotime($c['birthday'])) == -1) {
            $c['birthday'] = "";
        } else {
            $c['birthday'] = $bday;
        }