<?php
// ======================================================================== //
//                                                                          //
//   KooBI- Webportalsystem                                                 //
//   SCRiPTMAFiA 2005 - THE DiRTY HANDS ON YOUR SCRiPTS                     //
//                                                                          //
//   ====================================================================   //
//                                                                          //   
//   dream4 | webservices - Am Michelsgrund 7 - 69469 Weinheim - Germany    //    
//   tel. +49(0) 6201 - 980442 / fax. +49(0) 6201 - 64809                   //
//                                                                          //
// ======================================================================== //
class dbc {
 	var $_handle;
 	var $_result;
 	
 	function dbc($sql) {
	 global $dbhost,$dbuser,$dbpass,$dbname;

	
		$this->_handle = "";
 		$this->_result = "";
 		
 		$this->_handle = mysql_connect($dbhost,$dbuser,$dbpass);
 		if (!$this->_handle) {
 			$this->_mysqlerror();
 			return false;
 		}
 		
		mysql_select_db($dbname);
 		$this->_result = mysql_query($sql,$this->_handle);
 		
		if (!$this->_result) {
 			$this->_dberror();
 			return false;
 		}
		
 		return true;
 	}
 	
	function dataseek() {
		return @mysql_data_seek($this->_result);
	}
	
 	function fetchrow() {
 		return @mysql_fetch_object($this->_result);
 	}
 	
 	function fetchrow_assoc() {
 		return @mysql_fetch_assoc($this->_result);
 	}
	
	function fetcharray() {
 		return @mysql_fetch_array($this->_result);
 	}
 	
	function numrows() {
 		return @mysql_num_rows($this->_result);
 	}
 	
 	function getid() {
 		return @mysql_insert_id($this->_handle);
 	}
 	
 	function close() {
 		@mysql_free_result($this->_result); 
 		$this->_handle = "";
 		$this->_result = "";
 	}
 	
	function mysql_version() {
		return  mysql_get_server_info($this->_handle);
	}
	
 	function _dberror() {
 		$fehler = mysql_error($this->_handle);
 		$fehlernr = mysql_errno($this->_handle);
		echo $fehler; //.'<pre><strong style="color:red">KOOBI-ERROR</strong><br />This Page cannot be indicated due to a incorrect input.<br />Please go to <a style="color:red" href="index.php">Startpage</a>.</pre>';
 		die("");
 	}
 }
?>