Example #1
0
    $d->debug = $w->debug;
    if (!$d->connect(DB_HOST, DB_USER, DB_PASS, DATABASE)) {
        $t->errors[ERROR][] = 'C001 ' . $l->txt_err_open_database;
        show_error_page($t, $o);
        // todo - erinevad tekstid
    }
}
$s = new SESSION($d);
$s->debug = $w->debug;
$s->d = $d;
// Kas selline ettevõte eksisteerib juba lokaalses andmebaasis?
if (!$s->get_organization_id($u->company)) {
    $c->name = $u->company;
    $c->country_id = '1';
    // TODO
    if (!$s->create_organization($c)) {
        $t->errors[ERROR][] = 'L005 ' . $l->txt_err_user_update;
        show_login_page($t, $o);
    }
    unset($c);
}
// Kas kasutaja on olemas lokaalses tabelis?
if (isset($p->uname)) {
    // Uni-ID puhul tullakse kasutajanimega
    $w->login_name = $p->uname;
}
if (strlen($w->login_name) < 3) {
    $t->errors[ERROR][] = 'L006 ' . $l->txt_err_authentication;
    show_login_page($t, $o);
}
if (!$s->get_user_id($w->login_name)) {