/*
(c) 2004-2008 concept2stage
****************************************************************************
* Bitte beachten Sie: Das Ändern dieser Datei ist nicht gestattet ! *
****************************************************************************
****************************************************************************
* Caution: Do not change this file. *
****************************************************************************
*/
$db="backlink-checker";
//echo "lang: ".$language;
$host="localhost";
$user="backlink-checker";
$passw="dd2580";
//$lk=mysql_connect($host,$user,$passw);
$lk=mysql_connect($host,$user,$passw) ;
$lk_slow=mysql_connect($host,$user,$passw,true);
if (!$lk || !$lk_slow) { echo "Database connection failed!"; exit; }
function db_query($sql) {
global $lk_slow,$main,$db;
//echo $sql."
";
if (is_object($main) && $main->loggedin) {
if (strpos($sql,".stats")!==false)
$sql=str_replace($db.".stats",$main->stat_db.".".$main->stat_table,$sql);
}
$res=mysql_query($sql,$lk_slow);
if (!$res) {
echo $sql."
";
var_dump(debug_backtrace());
}
return $res;
}
function db_smart_fetch($sql) {
return db_fetch_array(db_query($sql));
}
function db_smarter_fetch($sql) {
$arr = db_fetch_array(db_query($sql));
if (count($arr)==2) return $arr[0]; else return $arr;
}
function db_unbuffered_query($sql) {
global $lk,$main,$db;
//echo $sql."
";
if (is_object($main) && $main->loggedin) {
if (strpos($sql,".stats")!==false)
$sql=str_replace($db.".stats",$main->stat_db.".".$main->stat_table,$sql);
}
$res=mysql_unbuffered_query($sql,$lk);
if (!$res) {
echo $sql."
";
var_dump(debug_backtrace());
}
return $res;
}
function db_input($s) {
return addslashes ($s);
}
function db_affected_rows() {
global $lk;
return mysql_affected_rows($lk);
}
function db_fetch_array($q) {
$arr=mysql_fetch_array($q);
return $arr;
}
function db_fetch_row($q) {
return mysql_fetch_row ($q);
}
function db_fetch_object($q) {
$obj=mysql_fetch_object ($q);
return $obj;
}
function num_rows($res) {
return mysql_num_rows($res);
}
function db_num_rows($res) {
if (is_string($res)) $res = db_query($res);
return mysql_num_rows($res);
}
function db_insert_id() {
global $lk_slow;
return mysql_insert_id($lk_slow);
}
function db_num_fields($res) {
return mysql_num_fields($res);
}
function db_field_type($res,$i) {
return mysql_field_type($res,$i);
}
function db_field_len($res,$i) {
return mysql_field_len($res,$i);
}
function db_field_name($res,$i) {
return mysql_field_name($res,$i);
}
function db_close() {
global $lk,$lk_slow;
return; //we dont need this shit
mysql_close($lk);
mysql_close($lk_slow);
}
function db_copy_item($table,$row,$replacement) {
$sql = "replace into ".$table." (";
$values = "";
foreach ($replacement as $key=>$val) $row[$key] = $val;
foreach ($row as $key=>$val) {
if (!is_numeric($key)) {
$sql.=$key.",";
$values.="'".db_input($val)."',";
}
}
$sql = rtrim($sql,",").") values (".rtrim($values,",").")";
db_query($sql);
return db_insert_id();
}
function getFieldBySQL($sql,$field=0) {
$res=db_query($sql);
if (is_numeric($field)) {
$arr=db_fetch_row($res);
return $arr[$field];
} else {
$obj=db_fetch_object($res);
return $obj->$field;
}
}
?>