WIP: create new test section
This commit is contained in:
9
homepage/cwsvJudo/configs/heliohost/config.json
Normal file
9
homepage/cwsvJudo/configs/heliohost/config.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"cwsvJudo": {
|
||||
"db": {
|
||||
"host": "localhost",
|
||||
"name": "cwsvjudo_main",
|
||||
"user": "cwsvjudo_marko"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
homepage/cwsvJudo/configs/heliohost/secrets.json
Normal file
7
homepage/cwsvJudo/configs/heliohost/secrets.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"cwsvJudo": {
|
||||
"db": {
|
||||
"cwsvjudo_marko": "kodokan"
|
||||
}
|
||||
}
|
||||
}
|
||||
2
homepage/cwsvJudo/src/pages/test/config.php
Normal file
2
homepage/cwsvJudo/src/pages/test/config.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?
|
||||
$home = "/home/cwsvjudo.helioho.st";
|
||||
27
homepage/cwsvJudo/src/pages/test/news.php
Normal file
27
homepage/cwsvJudo/src/pages/test/news.php
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user