name = mysql_field_name($result, $index); $this->type = mysql_field_type($result, $index); $this->len = mysql_field_len($result, $index); } } class classTables { var $db_name; var $name; function classTables($db_name, $index) { $this->db_name = $db_name; $result = mysql_list_tables($db_name); $this->name = mysql_tablename($result, $index); } function get_field($index) { return new classFields($this->db_name, $this->name, $index); } function count_fields() { return mysql_num_fields(mysql_list_fields($this->db_name, $this->name)); } } // simple database handling class database { var $name; var $db_connection=0; var $result; var $rs; var $debug; function database($name = "", $permanent = true) { $this->name = DB; if ($name != "") $this->name = $name; if ($permanent) $this->db_connection = mysql_pconnect(DBHOST, DBUSER, DBPASS) // persistent connections are faster or die("Cannot connect to database"); else $this->db_connection = mysql_connect(DBHOST, DBUSER, DBPASS) // persistent connections are faster or die("Cannot connect to database"); mysql_select_db($this->name,$this->db_connection) or die("Cannot open database ".$this->name); mysql_query("SET NAMES 'utf8'"); mysql_query("SET CHARACTER SET utf8"); $this->debug = 0; } function get_table($index) { return new classTables($this->name, $index); } function count_tables() { return mysql_num_rows(mysql_list_tables($this->name)); } function count_fields() { // num of fields in current query return mysql_num_fields($this->result); } function get_field_names() { // make tablerow with the fieldnames of the current query $result = ""; for ($i==0; $iresult); $i++) $result .= "".mysql_field_name($this->result, $i).""; $result .= ""; return $result; } function get_field_values() { // make tablerow with the fieldvalues of the current query $result = ""; for ($i==0; $iresult); $i++) { $value = $this->rs[mysql_field_name($this->result, $i)]; $result .= "".(($value)?$value:" ").""; } $result .= ""; return $result; } function query($sqlstring) { // execute a query and return a querytype-specific return value if (isset($GLOBALS["debug"])) echo $sqlstring."
"; if ($this->db_connection==0) return false; $sqlkwd=explode(" ",strToLower(trim($sqlstring))); if ($sqlkwd[0]=="insert") return $this->insert($sqlstring); // return id of inserted recordset if ($sqlkwd[0]=="select") return $this->select($sqlstring); // return number of selected records if ($sqlkwd[0]=="update") return $this->update($sqlstring); // return number of updates records if ($sqlkwd[0]=="delete") return $this->delete($sqlstring); // return number of deletes records return $this->result = mysql_query($sqlstring); // for default query // return false; //unsupported sql statement } // method: item // arguments: $key -> field name in the result // action: get value of a field function item($key) { return $this->rs[$key]; } // method: movenext // arguments: none // action: advance to next record of the result function movenext() { $this->rs = mysql_fetch_array($this->result, MYSQL_ASSOC); // create an associative array } function nextrecord() { return $this->rs = mysql_fetch_array($this->result, MYSQL_ASSOC); // create an associative array } function insert($sqlstring) { if ($this->db_connection==0) return false; if ($this->debug) print "$sqlstring
"; $this->result = mysql_query($sqlstring, $this->db_connection) // execute or quit with error or die("".mysql_errno()." ".mysql_error()."
Invalid query
$sqlstring
"); if (mysql_error($this->db_connection)!="") return -1; $result = mysql_insert_id($this->db_connection); return $result; } function select($sqlstring) { if ($this->db_connection==0) return false; if ($this->debug) print "$sqlstring
"; $this->result = mysql_query($sqlstring, $this->db_connection) // execute or quit with error or die("".mysql_errno()." ".mysql_error()."
Invalid query
$sqlstring
"); if (mysql_error($this->db_connection)!="") { return 0; } return mysql_num_rows($this->result); } function delete($sqlstring) { if ($this->db_connection==0) return false; if ($this->debug) print "$sqlstring
"; $this->result = mysql_query($sqlstring,$this->db_connection) // execute or quit with error or die("".mysql_errno()." ".mysql_error()."
Invalid query
$sqlstring
"); if (mysql_error($this->db_connection)!="") return -1; return mysql_affected_rows($this->db_connection); } function update($sqlstring) { if ($this->db_connection==0) return false; if ($this->debug) print "$sqlstring
"; $this->result = mysql_query($sqlstring,$this->db_connection) // execute or quit with error or die("".mysql_errno()." ".mysql_error()."
Invalid query
$sqlstring
"); if (mysql_error($this->db_connection)!="") return -1; return mysql_affected_rows($this->db_connection); } function rewind_result() { if ($this->db_connection==0) return false; mysql_data_seek($this->result,0); } function close() { if ($this->db_connection==0) // persistend db-connection do not need to be closed return 0; //mysql_close($this->db_connection); // persistent db-connections cannot be closed return 1; } function create_table($tablename, $tabledef) { // create a table with name = $tablename and column definition = $tabledef if ($this->db_connection==0) return 0; mysql_query("CREATE TABLE ".$tablename." (".$tabledef.")", $this->db_connection) // execute or quit with error or die("".mysql_errno()." ".mysql_error()."
Can't create table
$tablename ($tabledef)
"); return 1; } function drop_table($tablename) { // delete a table with name = $tablename if ($this->db_connection==0) return 0; mysql_query("DROP TABLE ".$tablename) // execute or quit with error or die("".mysql_errno()." ".mysql_error()."
Can't drop table
$tablename ($tabledef)
"); return 1; } } ?> Sie haben sich erfolgreich abgemeldet!"; header("Location: /".$lang."/kundenzone/?error=".$error); } if($oDB->query("SELECT * FROM tbl_pages_".$lang." WHERE PAG_cName = '$level_one'")){ $oDB->nextrecord(); $p_level1=$oDB->item("PAG_ID"); $site=$oDB->item("PAG_cFilename"); $p=$p_level1; } if($oDB2->query("SELECT * FROM tbl_pages_".$lang." WHERE PAG_cName = '$level_two' AND PAG_cID_Parent_ID = '$p_level1'")){ $oDB2->nextrecord(); $p_level2=$oDB2->item("PAG_ID"); $site=$oDB2->item("PAG_cFilename"); $p=$p_level2; } if($oDB3->query("SELECT * FROM tbl_pages_".$lang." WHERE PAG_cName = '$level_three' AND PAG_cID_Parent_ID = '$p_level2'")){ $oDB3->nextrecord(); $site=$oDB3->item("PAG_cFilename"); $p=$oDB3->item("PAG_ID"); } include $_SERVER['DOCUMENT_ROOT']."/include/get_metatags.php"; include $_SERVER['DOCUMENT_ROOT']."/cms/cms_header.inc.php"; $oDB4->query("SELECT * FROM tbl_pages_".$lang." WHERE PAG_ID = '".$p."'"); $oDB4->nextrecord(); $oDB5->query("SELECT * FROM tbl_pages_".$lang." WHERE PAG_ID = '".$oDB4->item("PAG_cID_Parent_ID")."'"); $oDB5->nextrecord(); if($oDB5->item("PAG_cName")=='NewsletterAkademie'&&$level_two){ $site="newsletter_generator.php"; } if (isset($_SESSION["edit"])&&$site="zoom.php"){ $site="content.php"; } if(!$site){ $p=1; $site="content.php"; } require($site); ?>