diff --git a/config.default.php b/config.default.php new file mode 100644 index 0000000..5cd832e --- /dev/null +++ b/config.default.php @@ -0,0 +1,9 @@ + "localhost", + 'user' => "temp", + 'password' => "temppw", + 'database' => "temp", +); + diff --git a/draw.php b/draw.php index 4ec6bcb..90b5aea 100644 --- a/draw.php +++ b/draw.php @@ -11,13 +11,13 @@ function generateChart($today,$mode,$hours=0,$dateInput){ global $day; global $month; global $year; + global $db; $diffuse=0; # 10min -+ start/end time $types=array('ambi1','ambi2','humi1','temp1','temp2','baro1'); $dummy=array(array(),array()); - $db=new DBLib('localhost','temp','temppw','temp'); $stats=""; $selectionStart=$selectionEnd=0; $chartname=""; diff --git a/index.php b/index.php index 306c50f..acad537 100644 --- a/index.php +++ b/index.php @@ -3,6 +3,7 @@ header("Cache-Control: no-cache, must-revalidate"); $start=microtime(true); date_default_timezone_set("Europe/Berlin"); +include('config.php'); include('lib/DBLib.php'); include('draw.php'); include('function.php'); @@ -86,6 +87,7 @@ if($mode==1){ if(!$error===false){ $html.=$error; }else{ + $db=new DBLib($database['host'],$database['user'],$database['password'],$database['database']); $html.=generateChart($today,$mode,$num,$date); } $runtime=microtime(true)-$start;