Commit b6b7f0cd authored by Frank Winkler's avatar Frank Winkler

Added port declaration for all databases.

parent a3042e5d
<?php
header("Access-Control-Allow-Origin: *");
define('HOST', '127.0.0.1');
define('PORT', '3306');
define('DATABASE', 'name');
define('USER', 'name');
define('PASSWORD', 'password');
define('INFLUX_HOST', '127.0.0.1');
define('INFLUX_PORT', '8086');
define('INFLUX_DATABASE', 'name');
define('INFLUX_USER', 'name');
define('INFLUX_PASSWORD', 'password');
define('INFLUX_LT_HOST', '127.0.0.1');
define('INFLUX_LT_PORT', '8086');
define('INFLUX_LT_DATABASE', 'name');
define('INFLUX_LT_USER', 'name');
define('INFLUX_LT_PASSWORD', 'password');
......
......@@ -2,7 +2,7 @@
require_once ('DatabaseConfig_ZIH.php');
function connectToDB() {
$connection_data = sprintf("mysql:host=%s;dbname=%s", HOST, DATABASE);
$connection_data = sprintf("mysql:host=%s;port=%s;dbname=%s", HOST, PORT, DATABASE);
try {
$pdo = new PDO($connection_data, USER, PASSWORD);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
......
......@@ -209,16 +209,17 @@
}
function get_database_connection($database, $start) {
$port = 8086;
$start_delta = time() - $start;
if ( $start_delta > 1814400 ) {
$host = INFLUX_LT_HOST;
$port = INFLUX_LT_PORT;
$database = INFLUX_LT_DATABASE;
$username = INFLUX_LT_USER;
$password = INFLUX_LT_PASSWORD;
} else {
$host = INFLUX_HOST;
$port = INFLUX_PORT;
$database = INFLUX_DATABASE;
$username = INFLUX_USER;
$password = INFLUX_PASSWORD;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment