3 * brisk - dbase_pgsql.phh
5 * Copyright (C) 2006-2012 Matteo Nastasi
6 * mailto: nastasi@alternativeoutput.it
7 * matteo.nastasi@milug.org
8 * web: http://www.alternativeoutput.it
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details. You should have received a
19 * copy of the GNU General Public License along with this program; if
20 * not, write to the Free Software Foundation, Inc, 59 Temple Place -
21 * Suite 330, Boston, MA 02111-1307, USA.
25 require_once("${G_base}Obj/dbase_base.phh");
27 $escsql_from = array( "\\", "'" );
28 $escsql_to = array( "\\\\", "\\'" );
32 GLOBAL $escsql_from, $escsql_to;
34 return str_replace($escsql_from, $escsql_to, $s);
39 static $dbcnnx = FALSE;
44 $this->db = DBConn::$dbcnnx;
47 static function create()
51 if (DBConn::$dbcnnx == FALSE) {
52 if (!(DBConn::$dbcnnx = @pg_connect ($G_dbauth, PGSQL_CONNECT_FORCE_NEW))) {
62 static function destroy()
64 if (DBConn::$dbcnnx != FALSE) {
65 DBConn::$dbcnnx = FALSE;
66 return (pg_close(DBConn::$dbcnnx));
71 static function recover()
74 return (self::create());
89 function BriskDB($dbconn)
91 $this->dbconn = $dbconn;
94 static function create()
96 GLOBAL $DOCUMENT_ROOT, $G_dbpfx;
100 log_main("BriskDB create:start");
103 if (($dbconn = DBConn::create()) == FALSE) {
107 $ret = new BriskDB($dbconn);
115 if (($res = pg_query($this->dbconn->db(), $sql)) == FALSE) {
116 // try to recover the connection
117 if (($this->dbconn = DBConn::recover()) == FALSE)
119 return (pg_query($this->dbconn->db(), $sql));
125 function last_error()
127 return pg_last_error($this->dbconn->db);
130 function users_load()
134 function login_exists($login)
138 /* check the existence of the nick in the BriskDB */
139 log_main("login_exists: ".$login);
141 $user_sql = sprintf("SELECT * FROM %susers WHERE login = lower('%s')",
142 $G_dbpfx, escsql($login));
143 if (($user_pg = $this->query($user_sql)) != FALSE)
144 if (pg_numrows($user_pg) == 1)
150 function getrecord_bylogin($login) {
153 $user_sql = sprintf("SELECT * FROM %susers WHERE login = lower('%s') AND (type & CAST (X'%08x' as integer)) = 0;", $G_dbpfx, escsql($login), USER_FLAG_TY_DISABLE);
154 if (($user_pg = $this->query($user_sql)) == FALSE) {
157 if (pg_numrows($user_pg) != 1)
160 $user_obj = pg_fetch_object($user_pg, 0);
165 function user_add($login, $pass, $email, $type, $disa_reas, $guar_code) {
168 $usr_sql = sprintf("INSERT INTO %susers (login, pass, email, type, disa_reas, guar_code, lintm)
169 VALUES ('%s', '%s', '%s', %d, %d, %d, now()) RETURNING *;",
170 $G_dbpfx, escsql(strtolower($login)), escsql($pass), escsql($email),
171 $type, $disa_reas, $guar_code);
173 if (! (($usr_pg = $this->query($usr_sql)) != FALSE && pg_affected_rows($usr_pg) == 1) ) {
176 $usr_obj = pg_fetch_object($usr_pg, 0);
181 function transaction($cmd) {
182 if ($cmd != "BEGIN" && $cmd != "COMMIT" && $cmd != "ROLLBACK")
185 $trans_sql = sprintf("%s;", $cmd);
186 if (($trans_pg = $this->query($trans_sql)) == FALSE) {
194 to be able to add mail record code into the record itself I must reserve it before.
196 function mail_reserve_code() {
199 $mail_sql = sprintf("SELECT nextval('%smails_code_seq'::regclass) AS nextval;", $G_dbpfx);
200 if (($mail_pg = $this->query($mail_sql)) == FALSE) {
203 if (pg_numrows($mail_pg) != 1)
206 $mail_obj = pg_fetch_object($mail_pg, 0);
208 return ($mail_obj->nextval);
211 function check_record_by_login_or_email($login, $email) {
214 $arr_fie = array('login', 'email');
215 $arr_val = array($login, $email);
217 for ($i = 0 ; $i < 2 ; $i++) {
218 $user_sql = sprintf("SELECT * FROM %susers WHERE %s = lower('%s');",
219 $G_dbpfx, $arr_fie[$i], escsql($arr_val[$i]));
220 if (($user_pg = $this->query($user_sql)) == FALSE) {
221 fprintf(STDERR, "QUERY [%s]_ FALSE", $user_sql);
224 if (pg_numrows($user_pg) == 1) {
232 function getrecord_bycode($code) {
235 $user_sql = sprintf("SELECT * FROM %susers WHERE code = %d;", $G_dbpfx, $code);
236 if (($user_pg = $this->query($user_sql)) == FALSE) {
239 if (pg_numrows($user_pg) != 1)
242 $user_obj = pg_fetch_object($user_pg, 0);
247 function user_update_login_time($code, $lintm)
251 $user_sql = sprintf("UPDATE %susers SET (lintm) = (date 'epoch' + %d * INTERVAL '1 second') WHERE code = %d;", $G_dbpfx, $lintm, $code);
253 if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
260 function user_update_flag_ty($code, $old_type, $old_reas, $type, $reas)
264 // (u.type & (CAST (X'00ff0000' as integer)))
266 $user_sql = sprintf("UPDATE %susers SET (type, disa_reas) = ((%d & (CAST (X'00ff0000' as integer))), %d)
267 WHERE code = %d AND (type & CAST (X'%08x' as integer)) != 0 AND disa_reas = %d;",
268 $G_dbpfx, $type, $reas, $code, $old_type, $old_reas);
270 if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
277 function user_update_passwd($code, $passwd)
281 $user_sql = sprintf("UPDATE %susers SET (pass) = (md5('%s')) WHERE code = %d;",
282 $G_dbpfx, $passwd, $code);
284 if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
291 function user_prefs_update($code, $flags, $supp_comp)
295 $user_sql = sprintf("UPDATE %susers SET (type, supp_comp) = (%d, '%s') WHERE code = %d;",
296 $G_dbpfx, $flags, escsql($supp_comp), $code);
297 fprintf(STDERR, "REQUEST [%s]\n", $user_sql);
298 if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
301 fprintf(STDERR, "REQUEST GOOD [%s]\n", $user_sql);
306 function user_state_update($code, $flags, $disa_reas)
310 $user_sql = sprintf("UPDATE %susers SET (type, disa_reas) = (%d, %d) WHERE code = %d;",
311 $G_dbpfx, $flags, $disa_reas, $code);
312 fprintf(STDERR, "REQUEST [%s]\n", $user_sql);
313 if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
316 fprintf(STDERR, "REQUEST GOOD [%s]\n", $user_sql);
321 function user_tos_update($code, $tos_vers)
325 $user_sql = sprintf("UPDATE %susers SET (tos_vers) = ('%s') WHERE code = %d;",
326 $G_dbpfx, escsql($tos_vers), $code);
327 fprintf(STDERR, "REQUEST [%s]\n", $user_sql);
328 if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
331 fprintf(STDERR, "REQUEST GOOD [%s]\n", $user_sql);
337 if success return a LoginDBItem object
339 function login_verify($login, $pass)
345 log_main("login_verify: ".$login);
347 //O /* check the existence of the nick in the BriskDB */
348 //O for ($i = 0 ; $i < $this->item_n ; $i++) {
349 //O log_main("login_verify: BEGIN");
351 if (($user_obj = $this->getrecord_bylogin($login)) == FALSE) {
355 log_main("login[".$user_obj->code."]: ".$user_obj->login);
357 /* if it exists check for a valid challenge */
358 if (($a_sem = Challenges::lock_data(TRUE)) != FALSE) {
359 if (($chals = &Challenges::load_data()) != FALSE) {
360 for ($e = 0 ; $e < $chals->item_n ; $e++) {
361 log_main("challenge[".$e."]: ".$chals->item[$e]->login);
362 if (strcmp($login, $chals->item[$e]->login) == 0) {
363 log_main("login_verify [".$pass."] with [".md5($chals->item[$e]->token.$user_obj->pass)."]");
365 if (strcmp($pass, md5($chals->item[$e]->token.$user_obj->pass)) == 0) {
366 log_main("login_verify SUCCESS for ".$login);
369 $this->user_update_login_time($user_obj->code, time());
370 $ret = LoginDBItem::LoginDBItemFromRecord($user_obj);
374 } // end for ($e = 0 ...
377 if ($chals->ismod()) {
378 Challenges::save_data(&$chals);
381 Challenges::unlock_data($a_sem);
384 // O } // if (strcasecmp($this->item[$i]->login, ...
390 function getitem_bylogin($login, &$id) {
394 log_main("getitem_bylogin: ".$login);
396 if (($user_obj = $this->getrecord_bylogin($login)) == FALSE)
399 $id = $user_obj->code;
400 return (LoginDBItem::LoginDBItemFromRecord($user_obj));
403 function getitem_bycode($code) {
406 log_main("getitem_bycode: ".$code);
408 if (($user_obj = $this->getrecord_bycode($code)) == FALSE)
411 return (LoginDBItem::LoginDBItemFromRecord($user_obj));
415 function getmail($login)
419 if (($ret = $this->getrecord_bylogin($login)) == FALSE)
422 return ($ret->email);
425 function addusers_from_olddb($olddb, &$cont)
429 for ($i = 0 ; $i < $olddb->count() ; $i++) {
430 $user_sql = sprintf("INSERT INTO %susers ( login, pass, email, type) VALUES ('%s', '%s', '%s', %d);",
431 $G_dbpfx, escsql(strtolower($olddb->item[$i]->login)), escsql($olddb->item[$i]->pass),
432 escsql($olddb->item[$i]->email), $olddb->item[$i]->type & USER_FLAG_TY_ALL);
434 if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
435 $cont .= sprintf("ERROR IN LINE: %s\n", eschtml($user_sql));
445 return ($this->dbconn);
448 // return array of array('code', 'login' [, 'first', 'last', 'tidx']) ordered by table position
449 function users_get($match_code, $with_minmaxtidx, $is_newmatch)
453 if ($is_newmatch) { // is new
454 $usr_sql = sprintf("SELECT u.code AS code, u.login AS login%s
455 FROM %sbin5_matches AS m, %sbin5_games AS g, %sbin5_points AS p,
456 %susers AS u, %sbin5_table_orders AS o
457 WHERE m.code = g.mcode AND g.code = p.gcode AND u.code = p.ucode
458 AND m.code = o.mcode AND u.code = o.ucode AND m.code = %d
459 GROUP BY u.code, u.login%s, o.pos
461 ($with_minmaxtidx ? ", min(g.tstamp) AS first, max(g.tstamp) AS last, m.tidx AS tidx" : ""),
462 $G_dbpfx, $G_dbpfx, $G_dbpfx, $G_dbpfx, $G_dbpfx, $match_code,
463 ($with_minmaxtidx ? ", m.tidx" : ""));
466 $usr_sql = sprintf("SELECT u.code AS code, u.login AS login%s
467 FROM %sbin5_matches AS m, %sbin5_games AS g, %sbin5_points AS p, %susers AS u
468 WHERE m.code = g.mcode AND g.code = p.gcode AND u.code = p.ucode AND m.code = %d
469 GROUP BY u.code, u.login%s;",
470 ($with_minmaxtidx ? ", min(g.tstamp) AS first, max(g.tstamp) AS last, m.tidx AS tidx" : ""),
471 $G_dbpfx, $G_dbpfx, $G_dbpfx, $G_dbpfx, $match_code,
472 ($with_minmaxtidx ? ", m.tidx" : ""));
475 if (($usr_pg = pg_query($this->dbconn->db(), $usr_sql)) == FALSE ) {
476 log_crit(sprintf("%s::%s: pg_query usr_sql failed [%s]", __CLASS__, __FUNCTION__, $usr_sql));
479 $usr_n = pg_numrows($usr_pg);
480 if ($usr_n != BIN5_PLAYERS_N) {
481 log_crit(sprintf("%s::%s: wrong number of players [%s] %d", __CLASS__, __FUNCTION__, $usr_sql, $usr_n));
486 if ($with_minmaxtidx)
487 $fields = array('code', 'login', 'first', 'last', 'tidx');
489 $fields = array('code', 'login');
491 for ($u = 0 ; $u < $usr_n ; $u++) {
492 $usr_obj = pg_fetch_object($usr_pg, $u);
493 $users[$u] = array();
494 foreach($fields as $field) {
495 $users[$u][$field] = $usr_obj->$field;
501 // out: tab->{points,points_n,old_reason}, in: tab->ttok
502 function match_continue($match_code, $table, $tidx)
505 $sql_ttok = escsql($table->table_token);
507 if (($users = $this->users_get($match_code, FALSE /*without minmaxidx*/, TRUE /*new game*/)) == FALSE) {
508 log_crit(sprintf("%s::%s: retrieve users fails", __CLASS__, __FUNCTION__));
512 $num_sql = sprintf("SELECT count(*) AS points_n FROM %sbin5_games WHERE mcode = %d;", $G_dbpfx, $match_code);
513 if (($num_pg = $this->query($num_sql)) == FALSE || pg_numrows($num_pg) != 1) {
514 log_crit(sprintf("%s::%s: get games number fails", __CLASS__, __FUNCTION__));
517 $num_obj = pg_fetch_object($num_pg, 0);
518 $table->points_n = $num_obj->points_n;
520 // TAG: POINTS_MANAGEMENT
521 $tot_sql = sprintf("SELECT sum(p.pts * (2^g.mult)) AS pts
522 FROM %sbin5_games AS g, %sbin5_points AS p, %susers AS u,
523 %sbin5_table_orders AS o
524 WHERE g.mcode = %d AND g.code = p.gcode AND p.ucode = u.code
525 AND p.ucode = o.ucode AND g.mcode = o.mcode
526 GROUP BY p.ucode, o.pos
528 $G_dbpfx, $G_dbpfx, $G_dbpfx, $G_dbpfx, $match_code);
529 if (($tot_pg = pg_query($this->dbconn->db(), $tot_sql)) == FALSE
530 || pg_numrows($tot_pg) != BIN5_PLAYERS_N) {
531 log_crit(sprintf("%s::%s: get games totals fails", __CLASS__, __FUNCTION__));
536 foreach ($users as $user) {
537 // TAG: POINTS_MANAGEMENT
538 $pts_sql = sprintf("SELECT p.pts AS pts, g.mult AS mult
539 FROM %sbin5_points as p, %sbin5_games as g
540 WHERE p.gcode = g.code AND g.mcode = %d AND p.ucode = %d
541 ORDER BY g.tstamp ASC
542 LIMIT %d OFFSET %d;",
543 $G_dbpfx, $G_dbpfx, $match_code, $user['code'],
545 ($num_obj->points_n < MAX_POINTS ? 0 : $num_obj->points_n - MAX_POINTS));
547 // points of the match for each user
548 if (($pts_pg = $this->query($pts_sql)) == FALSE) {
549 log_crit(sprintf("%s::%s: get points fails", __CLASS__, __FUNCTION__));
552 $pts_n = pg_numrows($pts_pg);
553 if ($pts_n > $table->points_n) {
554 // inconsistent scenario number of points great than number of games
555 log_crit(sprintf("%s::%s: number of points great than number of games", __CLASS__, __FUNCTION__));
558 // TAG: POINTS_MANAGEMENT
559 for ($i = 0 , $ct = $table->points_n - $pts_n; $ct < $table->points_n ; $ct++, $i++) {
560 $pts_obj = pg_fetch_object($pts_pg, $i);
561 $table->points[$ct % MAX_POINTS][$u] = $pts_obj->pts * pow(2, $pts_obj->mult);
563 $tot_obj = pg_fetch_object($tot_pg, $u);
564 $table->total[$u] = $tot_obj->pts;
569 $gam_sql = sprintf("SELECT * FROM %sbin5_games WHERE mcode = %d ORDER BY tstamp DESC LIMIT 1;", $G_dbpfx, $match_code);
570 if (($gam_pg = $this->query($gam_sql)) == FALSE || pg_numrows($gam_pg) != 1) {
571 log_crit(sprintf("%s::%s: get last game fails", __CLASS__, __FUNCTION__));
574 $gam_obj = pg_fetch_object($gam_pg, 0);
576 $table->old_reason = game_description($gam_obj->act, 'html', $gam_obj->mult,
577 $gam_obj->asta_win, ($gam_obj->asta_win != -1 ?
578 $users[$gam_obj->asta_win]['login'] : ""),
579 $gam_obj->friend, ($gam_obj->friend != -1 ?
580 $users[$gam_obj->friend]['login'] : ""),
581 $gam_obj->pnt, $gam_obj->asta_pnt);
583 // update matches with new ttok and table idx
584 $mtc_sql = sprintf("UPDATE %sbin5_matches SET (ttok, tidx) = ('%s', %d) WHERE code = %d RETURNING *;",
585 $G_dbpfx, $sql_ttok, $tidx, $match_code);
586 if (($mtc_pg = $this->query($mtc_sql)) == FALSE || pg_numrows($mtc_pg) != 1) {
587 log_crit(sprintf("%s::%s: update matches table failed", __CLASS__, __FUNCTION__));
594 function match_order_get(&$match_data, $match_code, $exp_num)
598 $ord_sql = sprintf("SELECT ucode FROM %sbin5_table_orders WHERE mcode = %d ORDER BY pos ASC;",
599 $G_dbpfx, $match_code);
601 if (($ord_pg = $this->query($ord_sql)) == FALSE || pg_numrows($ord_pg) != $exp_num) {
602 log_crit(sprintf("%s: fails for id or users number", __FUNCTION__));
607 for ($i = 0 ; $i < $exp_num ; $i++) {
608 $ord_obj = pg_fetch_object($ord_pg, $i);
609 $ucodes[$i] = $ord_obj->ucode;
612 if ($match_data !== NULL) {
613 $mtdt_sql = sprintf("SELECT * FROM %sbin5_matches WHERE code = %d;",
614 $G_dbpfx, $match_code);
616 if (($mtdt_pg = $this->query($mtdt_sql)) == FALSE || pg_numrows($mtdt_pg) != 1) {
617 log_crit(sprintf("%s: fails retrieve match_data values [%d]", __FUNCTION__, $match_code));
621 $mtdt_obj = pg_fetch_object($mtdt_pg, 0);
623 foreach (array('ttok', 'tidx', 'mult_next', 'mazzo_next', 'tcode') as $match_name) {
624 $match_data[$match_name] = $mtdt_obj->$match_name;
633 function bin5_points_save($date, $table, $tidx, $action, $ucodes, $pts)
636 $sql_ttok = escsql($table->table_token);
642 /* check the existence of the nick in the BriskDB */
643 log_main("bin5_points_save: ");
646 if ($this->query("BEGIN") == FALSE) {
654 $mtc_sql = sprintf("UPDATE %sbin5_matches SET (mazzo_next, mult_next) = (%d, %d) WHERE ttok = '%s' RETURNING *;",
655 $G_dbpfx, $table->mazzo, $table->mult, $sql_ttok);
656 if (($mtc_pg = $this->query($mtc_sql)) == FALSE || pg_numrows($mtc_pg) != 1) {
658 // match not exists, insert it
659 $mtc_sql = sprintf("INSERT INTO %sbin5_matches (ttok, tidx, mazzo_next, mult_next) VALUES ('%s', %d, %d, %d) RETURNING *;",
660 $G_dbpfx, $sql_ttok, $tidx, $table->mazzo, $table->mult);
661 if (($mtc_pg = $this->query($mtc_sql)) == FALSE || pg_affected_rows($mtc_pg) != 1) {
662 log_crit(sprintf("bin5_points_save: failed at insert match [%s]", $mtc_sql));
665 $mtc_obj = pg_fetch_object($mtc_pg, 0);
667 for ($i = 0 ; $i < $n ; $i++) {
668 $ord_sql = sprintf("INSERT INTO %sbin5_table_orders (mcode, ucode, pos) VALUES (%d, %d, %d);",
669 $G_dbpfx, $mtc_obj->code, $ucodes[$i], $i);
670 if (($ord_pg = $this->query($ord_sql)) == FALSE || pg_affected_rows($ord_pg) != 1 ) {
671 log_crit(sprintf("bin5_points_save: failed at insert table order [%s]", $ord_sql));
679 $mtc_obj = pg_fetch_object($mtc_pg,0);
685 $gam_sql = sprintf("INSERT INTO %sbin5_games (mcode, tstamp, act, asta_pnt, pnt, asta_win, friend, mazzo, mult)
686 VALUES (%d, to_timestamp(%d), %d, %d, %d, %d, %d, %d, %d) RETURNING *;",
687 $G_dbpfx, $mtc_obj->code, $date, $action,
688 $table->old_asta_pnt, $table->old_pnt,
689 $table->old_asta_win,
691 $table->old_mazzo, $table->old_mult);
692 if (($gam_pg = $this->query($gam_sql)) == FALSE || pg_affected_rows($gam_pg) != 1) {
693 log_crit(sprintf("bin5_points_save: failed at insert game [%s]", $gam_sql));
697 $gam_obj = pg_fetch_object($gam_pg,0);
702 for ($i = 0 ; $i < $n ; $i++) {
704 $pts_sql = sprintf("INSERT INTO %sbin5_points (gcode, ucode, pts)
705 VALUES (%d, %d, %d);",
706 $G_dbpfx, $gam_obj->code, $ucodes[$i], $pts[$i]);
707 if (($pts_pg = $this->query($pts_sql)) == FALSE || pg_affected_rows($pts_pg) != 1) {
708 log_crit(sprintf("bin5_points_save: failed at insert point [%s]", $pts_sql));
715 if ($this->query("COMMIT") == FALSE) {
721 $table->match_id = $mtc_obj->code;
726 $this->query("ROLLBACK");
731 function mail_add_fromitem($mail) {
735 INSERT INTO %smails (code, ucode, type, tstamp, subj, body_txt, body_htm, hash)
736 VALUES (%d, %d, %d, to_timestamp(%d), '%s', '%s', '%s', '%s') RETURNING *;",
737 $G_dbpfx, $mail->code, $mail->ucode, $mail->type, $mail->tstamp,
738 escsql($mail->subj), escsql($mail->body_txt), escsql($mail->body_htm),
739 ($mail->hash == NULL ? "" : escsql($mail->hash))
742 if (! (($usr_pg = $this->query($usr_sql)) != FALSE && pg_affected_rows($usr_pg) == 1) ) {
745 $usr_obj = pg_fetch_object($usr_pg, 0);
750 function mail_check($code, $type, $hash)
754 $mai_sql = sprintf("SELECT * FROM %smails WHERE code = %d AND type = %d AND hash = '%s';",
755 $G_dbpfx, $code, $type, escsql($hash));
756 if (($mai_pg = $this->query($mai_sql)) == FALSE || pg_numrows($mai_pg) != 1) {
761 $mai_obj = pg_fetch_object($mai_pg, 0);
765 function mail_delete($code)
769 $mai_sql = sprintf("DELETE FROM %smails WHERE code = %d;", $G_dbpfx, $code);
771 if (($mai_pg = $this->query($mai_sql)) == FALSE || pg_affected_rows($mai_pg) != 1) {
778 } // End class BriskDB
785 function LoginDBOld($filename)
787 GLOBAL $DOCUMENT_ROOT;
788 log_main("LoginDBOld create:start");
790 if (file_exists("$DOCUMENT_ROOT/Etc/".$filename)) {
791 require("$DOCUMENT_ROOT/Etc/".$filename);
796 $this->item_n = count($this->item);
797 log_main("LoginDBOld create:end");
802 return ($this->item_n);
805 } // End class LoginDBOld