moved database-informations to config.php, added sample config
parent
f7774cfc38
commit
98f0a3c717
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$database = array(
|
||||||
|
'host' => "localhost",
|
||||||
|
'user' => "temp",
|
||||||
|
'password' => "temppw",
|
||||||
|
'database' => "temp",
|
||||||
|
);
|
||||||
|
|
||||||
2
draw.php
2
draw.php
|
|
@ -11,13 +11,13 @@ function generateChart($today,$mode,$hours=0,$dateInput){
|
||||||
global $day;
|
global $day;
|
||||||
global $month;
|
global $month;
|
||||||
global $year;
|
global $year;
|
||||||
|
global $db;
|
||||||
|
|
||||||
$diffuse=0; # 10min -+ start/end time
|
$diffuse=0; # 10min -+ start/end time
|
||||||
|
|
||||||
$types=array('ambi1','ambi2','humi1','temp1','temp2','baro1');
|
$types=array('ambi1','ambi2','humi1','temp1','temp2','baro1');
|
||||||
$dummy=array(array(),array());
|
$dummy=array(array(),array());
|
||||||
|
|
||||||
$db=new DBLib('localhost','temp','temppw','temp');
|
|
||||||
$stats="";
|
$stats="";
|
||||||
$selectionStart=$selectionEnd=0;
|
$selectionStart=$selectionEnd=0;
|
||||||
$chartname="";
|
$chartname="";
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
header("Cache-Control: no-cache, must-revalidate");
|
header("Cache-Control: no-cache, must-revalidate");
|
||||||
$start=microtime(true);
|
$start=microtime(true);
|
||||||
date_default_timezone_set("Europe/Berlin");
|
date_default_timezone_set("Europe/Berlin");
|
||||||
|
include('config.php');
|
||||||
include('lib/DBLib.php');
|
include('lib/DBLib.php');
|
||||||
include('draw.php');
|
include('draw.php');
|
||||||
include('function.php');
|
include('function.php');
|
||||||
|
|
@ -86,6 +87,7 @@ if($mode==1){
|
||||||
if(!$error===false){
|
if(!$error===false){
|
||||||
$html.=$error;
|
$html.=$error;
|
||||||
}else{
|
}else{
|
||||||
|
$db=new DBLib($database['host'],$database['user'],$database['password'],$database['database']);
|
||||||
$html.=generateChart($today,$mode,$num,$date);
|
$html.=generateChart($today,$mode,$num,$date);
|
||||||
}
|
}
|
||||||
$runtime=microtime(true)-$start;
|
$runtime=microtime(true)-$start;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue