22 lines
634 B
PHP
22 lines
634 B
PHP
<?php
|
|
|
|
define('DB_HOST', 'localhost');
|
|
define('DB_USER', 'smarthome_user');
|
|
define('DB_PASSWORD', 'motdepasse123');
|
|
define('DB_NAME', 'smarthome');
|
|
|
|
define('JWT_SECRET', 'smarthome_secret_key_2024_smart_home_project_very_long_key');
|
|
|
|
define('MQTT_BROKER', 'localhost');
|
|
define('MQTT_PORT', 1883);
|
|
define('MQTT_TOPIC_CLIMATE', 'smarthome/climate');
|
|
define('MQTT_TOPIC_SECURITY', 'smarthome/security');
|
|
|
|
function get_db() {
|
|
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
|
|
if ($conn->connect_error) {
|
|
die(json_encode(['error' => 'Connexion échouée : ' . $conn->connect_error]));
|
|
}
|
|
return $conn;
|
|
}
|
|
?>
|