From f6be9edd401664d95e60ae3c81aeaf36723ba891 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 8 Feb 2009 04:48:53 +0000 Subject: added login capability --- db.class.php | 100 +++++++++++++++++++++++++---------------------------------- 1 file changed, 43 insertions(+), 57 deletions(-) (limited to 'db.class.php') diff --git a/db.class.php b/db.class.php index 6603804..28dba49 100644 --- a/db.class.php +++ b/db.class.php @@ -1,61 +1,47 @@ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - class DB { - var $user, $pass, $host, $dbname; - var $db; - var $res; - - function DB($user, $pass, $host, $dbname) { - $this->user = $user; - $this->pass = $pass; - $this->host = $host; - $this->dbname = $dbname; - - $this->connect(); - } - - function connect() { - $this->db = mysql_connect($this->host, $this->user, $this->pass) - or $this->error("Verbindungsaufbau fehlgeschlagen"); - - mysql_select_db($this->dbname); - } - - function error($msg) { - die($msg . ": " . @mysql_error()); - } - - function query($query) { - $this->res = mysql_query($query, $this->db) - or $this->error("Fehler bei Datenbankanfrage"); - } - - function numObjects() { - return mysql_num_rows($this->res); - } - - function getNextObject() { - if (!$this->res) { - return; - } - return mysql_fetch_object($this->res); - } +var $user, $pass, $host, $dbname; +var $db; +var $res; + +function DB($user, $pass, $host, $dbname) { + $this->user = $user; + $this->pass = $pass; + $this->host = $host; + $this->dbname = $dbname; + $this->connect(); +} + +function connect() { + $this->db = mysql_connect($this->host, $this->user, $this->pass) + or $this->error("Verbindungsaufbau fehlgeschlagen"); + mysql_select_db($this->dbname); +} + +function error($msg) { + die($msg . ": " . @mysql_error()); +} + +function query($query) { + $this->res = mysql_query($query, $this->db) + or $this->error("Fehler bei Datenbankanfrage"); } + +function escape_string($string) { + return mysql_real_escape_string($string, $this->db); +} + +function numObjects() { + return mysql_num_rows($this->res); +} + +function getNextObject() { + if (!$this->res) { + return; + } + return mysql_fetch_object($this->res); + } +} + + ?> -- cgit v1.2.1