summaryrefslogtreecommitdiff
path: root/db.class.php
diff options
context:
space:
mode:
authorChristian Pointner <equinox@ffgraz.net>2009-02-08 04:48:53 +0000
committerChristian Pointner <equinox@ffgraz.net>2009-02-08 04:48:53 +0000
commitf6be9edd401664d95e60ae3c81aeaf36723ba891 (patch)
tree86f2127f51f0f16053c1b593c722cf0a5eeecba4 /db.class.php
parent0c420c393dba896e14972ecb5181904f1a1342a4 (diff)
added login capability
Diffstat (limited to 'db.class.php')
-rw-r--r--db.class.php100
1 files changed, 43 insertions, 57 deletions
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 @@
<?php
-/*
- * Copyright (C) 2006 Gaubatz Patrick <patrick@gaubatz.at>
- *
- * 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);
+ }
+}
+
+
?>