Skip to content
Snippets Groups Projects
Commit f3e532e5 authored by Philip's avatar Philip
Browse files

Config Änderungen

SQL Klasse mit Parameter
parent d604e718
No related branches found
No related tags found
No related merge requests found
<?php
session_start();
include("include/config.php");
require_once("classes/SQL.php");
include("include/_head.php");
include("include/config.php");
$loggedIn = false;
$loginFailed = true;
......@@ -49,7 +50,7 @@ if (!$loggedIn){
</form>
';
}else{
$sql = new SQL();
$sql = new SQL($DBHOST, $DBUSER, $DBPASS, $DBNAME);
$link = $sql->getLink();
$exist = false;
......
......@@ -2,11 +2,10 @@
if (isset($_POST["param"])){
require_once("../classes/SQL.php");
include("../include/config.php");
require_once("../classes/SQL.php");
$sql = new SQL();
$sql = new SQL($DBHOST, $DBUSER, $DBPASS, $DBNAME);
$link = $sql->getLink();
$query = "SELECT ".$TBL_DATA.".id as id, ".$TBL_PARAMETER.".param as param, ".$TBL_DATA.".value as value, DATE_FORMAT(".$TBL_DATA.".timestamp, '%d.%m.%Y %H:%i:%s') as date FROM (".$TBL_REGISTER." INNER JOIN ".$TBL_PARAMETER." ON ".$TBL_REGISTER.".id = ".$TBL_PARAMETER.".fid_register) INNER JOIN ".$TBL_DATA." ON ".$TBL_PARAMETER.".id = ".$TBL_DATA.".fid_parameter WHERE ".$TBL_DATA.".fid_parameter = ".$_POST["param"]." ORDER BY ".$TBL_DATA.".id DESC LIMIT 1";
......
<?php
class SQL{
private $link;
private $dbHost = "localhost";
private $dbUser = "root";
private $dbPass = "";
private $dbName = "iot";
function __construct(){
$this->link = new mysqli($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
function __construct($dbHost, $dbUser, $dbPass, $dbName){
$this->link = new mysqli($dbHost, $dbUser, $dbPass, $dbName);
$this->link->set_charset("utf8");
}
......
<?php
include("include/config.php");
require_once("classes/SQL.php");
include("include/_head.php");
include("include/config.php");
?>
<?php
$sql = new SQL();
$sql = new SQL($DBHOST, $DBUSER, $DBPASS, $DBNAME);
$link = $sql->getLink();
if (isset($_GET["param"])){
......
<?php // content="text/plain; charset=utf-8"
require_once ('include/config.php');
require_once ('classes/jpgraph/jpgraph.php');
require_once ('classes/jpgraph/jpgraph_line.php');
require_once ('classes/SQL.php');
require_once ('include/config.php');
if (isset($_GET["param"])){
if (isset($_GET["details"]) && $_GET["details"] == "yes"){
......@@ -11,7 +12,7 @@ if (isset($_GET["param"])){
$showDetails = false;
}
$sql = new SQL();
$sql = new SQL($DBHOST, $DBUSER, $DBPASS, $DBNAME);
$link = $sql->getLink();
$dataY = array();
......
<?php
// Database
$TBL_PARAMETER = "tbl_parameter";
$TBL_REGISTER = "tbl_register";
$TBL_DATA = "tbl_data";
$TBL_ADDRESSES = "tbl_addresses";
$TBL_UNREGISTERED = "tbl_unregistered";
$DBHOST = "localhost";
$DBUSER = "root";
$DBPASS = "";
$DBNAME = "iot";
$GRAPHPOINTS = -50;
$THUMBSIZE = 4; // 1 min, 12 max
$TABLELINESPERPAGE = 50;
// Dashboard
$DEVICEOFFLINETIME = 24; // Nach X Stunden Inaktivität vom Dashboard entfernen
$REFRESHINTERVAL = 25; // Alle X Sekunden Daten im Dashboard neu laden
$THUMBSIZE = 4; // Größe der Vorschaubilder - 1 min, 12 max
// Wenn letzte Nachricht älter als X Stunden, wird das Gerät aus dem Dashboard entfernt
$DEVICEOFFLINETIME = 24;
// Graphs
$GRAPHPOINTS = 50; // Anzahl der X letzten Messungen im Graphen
$REFRESHINTERVAL = 25;
// Details
$TABLELINESPERPAGE = 50; // Anzahl der Tabelleneinträge pro Seite
......@@ -21,4 +28,5 @@ $REFRESHINTERVAL = 25;
$DEVICEOFFLINETIME = $DEVICEOFFLINETIME * 60;
$REFRESHINTERVAL = $REFRESHINTERVAL * 1000;
$GRAPHPOINTS = $GRAPHPOINTS * (-1);
?>
\ No newline at end of file
<?php
include("include/config.php");
require_once("classes/SQL.php");
include("include/_head.php");
include("include/config.php");
?>
<!-- Page Header -->
......@@ -13,7 +14,7 @@ include("include/config.php");
</div>
<?php
$sql = new SQL();
$sql = new SQL($DBHOST, $DBUSER, $DBPASS, $DBNAME);
$link = $sql->getLink();
$graphs = array();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment