WIP: create new test section

This commit is contained in:
marko
2025-05-07 12:05:08 +02:00
parent bebb2afc03
commit 0c415d4c3f
4 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
{
"cwsvJudo": {
"db": {
"host": "localhost",
"name": "cwsvjudo_main",
"user": "cwsvjudo_marko"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"cwsvJudo": {
"db": {
"cwsvjudo_marko": "kodokan"
}
}
}

View File

@@ -0,0 +1,2 @@
<?
$home = "/home/cwsvjudo.helioho.st";

View File

@@ -0,0 +1,27 @@
<?
require_once("config.php");
$config = json_decode(
file_get_contents($home."/.local/config.json"),
true
);
$secrets = json_decode(
file_get_contents($home."/.local/secrets.json"),
true
);
var_dump($config);
try {
$conn = new PDO(
"mysql:host=".$config['cwsvJudo']['db']['host'].";dbname=".$config['cwsvJudo']['db']['name'],
$config['cwsvJudo']['db']['user'],
$secrets['cwsvJudo']['db'][$config['cwsvJudo']['db']['user']]
);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
} catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}