Benutzerinformationen überspringen
Registrierungsdatum: 22. März 2008
Wohnort: Lohr
WBB Version: alle
|
|
PHP-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
<?php
// ************************************************************************************//
// * WoltLab Burning Board 2
// ************************************************************************************//
// * Copyright (c) 2001-2004 WoltLab GmbH
// * Web [URL]http://www.woltlab.de/[/URL]
// * License [URL]http://www.woltlab.de/products/burning_board/license_en.php[/URL]
// * [URL]http://www.woltlab.de/products/burning_board/license.php[/URL]
// ************************************************************************************//
// * WoltLab Burning Board 2 is NOT free software.
// * You may not redistribute this package or any of it's files.
// ************************************************************************************//
// * $Date: 2006-01-30 19:14:12 +0100 (Mon, 30 Jan 2006) $
// * $Author: Burntime $
// * $Rev: 1691 $
// ************************************************************************************//
class db {
var $link_id = 0;
var $query_id = 0;
var $record = array();
var $errdesc = '';
var $errno = 0;
var $version = '';
var $show_error = 1;
var $server = '';
var $user = '';
var $password = '';
var $database = '';
var $use_unbuffered_query = false;
var $appname = 'WoltLab Burning Board';
function db($server, $user, &$password, $database, $phpversion) {
$this->server = $server;
$this->user = $user;
$this->password = $password;
$this->database = $database;
$password = '';
// use mysql_unbuffered_query ? (need php >= 4.0.6)
//if (version_compare($phpversion, "4.0.6") != -1) $this->use_unbuffered_query = true;
$this->connect();
$this->password = '';
}
function connect() {
$this->link_id = @mysql_connect($this->server, $this->user, $this->password);
if (!$this->link_id) $this->error("Link-ID == false, connect failed");
if ($this->database != '') $this->select_db($this->database);
}
function geterrdesc() {
$this->error = mysql_error();
return $this->error;
}
function geterrno() {
$this->errno = mysql_errno();
return $this->errno;
}
function getversion() {
if ($this->link_id) list($this->version) = $this->query_first("SELECT VERSION()", 0, 0, MYSQL_BOTH, 0);
if (!$this->version) $this->version = "unknown";
return $this->version;
}
function select_db($database = '') {
if ($database != '') $this->database = $database;
if (!@mysql_select_db($this->database, $this->link_id)) $this->error("cannot use database ".$this->database);
}
function query($query_string, $limit = 0, $offset = 0, $showerror = 1) {
if ($limit != 0) $query_string .= " LIMIT $offset, $limit";
$this->query_id = mysql_query($query_string, $this->link_id);
if ($showerror == 1 && !$this->query_id) $this->error("Invalid SQL: ".$query_string);
return $this->query_id;
}
function unbuffered_query($query_string, $LOW_PRIORITY = 0, $limit = 0, $offset = 0, $showerror = 1) {
if (!$this->use_unbuffered_query) return $this->query($query_string, $limit, $offset, $showerror);
else {
//if ($LOW_PRIORITY == 1) $query_string = preg_replace("/^(INSERT|UPDATE|DELETE|REPLACE)(.*)/si", "\\1 LOW_PRIORITY\\2", $query_string);
if ($limit != 0) $query_string .= " LIMIT $offset, $limit";
$this->query_id = mysql_unbuffered_query($query_string, $this->link_id);
if ($showerror == 1 && !$this->query_id) $this->error("Invalid SQL: ".$query_string);
return $this->query_id;
}
}
function fetch_array($query_id = -1, $type = MYSQL_BOTH) {
if ($query_id != -1) $this->query_id = $query_id;
$this->record = mysql_fetch_array($this->query_id, $type);
return $this->record;
}
function fetch_row($query_id = -1) {
if ($query_id != -1) $this->query_id = $query_id;
$this->record = mysql_fetch_row($this->query_id);
return $this->record;
}
function query_first($query_string, $limit = 0, $offset = 0, $type = MYSQL_BOTH, $showerror = 1) {
$this->query($query_string, $limit, $offset, $showerror = 1);
$returnarray = $this->fetch_array($this->query_id, $type);
return $returnarray;
}
function num_rows($query_id = -1) {
if ($query_id != -1) $this->query_id = $query_id;
return mysql_num_rows($this->query_id);
}
function affected_rows() {
return mysql_affected_rows($this->link_id);
}
function insert_id() {
return mysql_insert_id($this->link_id);
}
function error($errormsg) {
global $boardversion;
$this->errdesc = mysql_error();
$this->errno = mysql_errno();
$errormsg = "<b>Database error in $this->appname ($boardversion):</b> $errormsg\n<br>";
$errormsg .= "<b>mysql error:</b> $this->errdesc\n<br>";
$errormsg .= "<b>mysql error number:</b> $this->errno\n<br>";
$errormsg .= "<b>mysql version:</b> ".$this->getversion()."\n<br>";
$errormsg .= "<b>php version:</b> ".phpversion()."\n<br>";
$errormsg .= "<b>Date:</b> ".date("d.m.Y @ H:i")."\n<br>";
$errormsg .= "<b>Script:</b> ".htmlconverter(getenv("REQUEST_URI"))."\n<br>";
$errormsg .= "<b>Referer:</b> ".htmlconverter(getenv("HTTP_REFERER"))."\n<br><br>";
if ($this->show_error) $errormsg = "$errormsg";
else $errormsg = "\n<!-- $errormsg -->\n";
die("</table><font face=\"Verdana\" size=2><b>SQL-DATABASE ERROR</b><br><br>".$errormsg."</font>");
}
function data_seek($result, $nr) {
if (!mysql_data_seek($result, $nr)) $this->error("Can't seek to row $i in result");
}
}
?>
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Darkwolf« (6. August 2009, 12:52)
Benutzerinformationen überspringen
Registrierungsdatum: 22. März 2008
Wohnort: Lohr
WBB Version: alle
Benutzerinformationen überspringen
Registrierungsdatum: 22. März 2008
Wohnort: Lohr
WBB Version: alle
Forensoftware: Burning Board® 3.1.7, entwickelt von WoltLab® GmbH