Compare commits

...

2 Commits
main ... dev

Author SHA1 Message Date
87630c8444 dev - es ok 2025-10-26 20:16:23 +01:00
8170066056 dev - change to connect db 2025-10-26 19:55:56 +01:00
11 changed files with 42 additions and 31 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
**/vendor **/vendor
**/vendor.old
**/certs/* **/certs/*
.env .env
helm-old helm-old

View File

@ -28,11 +28,12 @@ services:
mariadb: mariadb:
image: mariadb:10.11.7 image: mariadb:10.11.7
#image: mariadb:lts-ubi9
# platform: linux/amd64,linux/arm64 # platform: linux/amd64,linux/arm64
volumes: volumes:
- 'mariadb:/var/lib/mysql:z' - 'mariadb:/var/lib/mysql:z'
env_file: env_file:
- ./docker/mariadb/.env - ./docker/mariadb/.env
phpmyadmin: phpmyadmin:
image: phpmyadmin image: phpmyadmin

View File

@ -30,4 +30,4 @@ function checkindex($user,$password,$host,$index)
curl_close($curl); curl_close($curl);
} }
return checkindex($es_user,$es_password,$es_host,$es_index) return checkindex($es_user,$es_password,$es_host,$es_index);

View File

@ -1,5 +1,5 @@
{ {
"require": { "require": {
"elasticsearch/elasticsearch": "^8.18" "elasticsearch/elasticsearch": "^8.19"
} }
} }

16
src/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "9ed50e8752b44f2433986b7a2af1554b", "content-hash": "80b524071699e69b978519d908dedf04",
"packages": [ "packages": [
{ {
"name": "elastic/transport", "name": "elastic/transport",
@ -66,20 +66,20 @@
}, },
{ {
"name": "elasticsearch/elasticsearch", "name": "elasticsearch/elasticsearch",
"version": "v8.18.0", "version": "v8.19.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/elastic/elasticsearch-php.git", "url": "https://github.com/elastic/elasticsearch-php.git",
"reference": "df8ee73046c688ee9ce2d69cb5c54a03ca38cc5c" "reference": "1771284cb43a7b653634d418b6f5f0ec84ff8a6d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/df8ee73046c688ee9ce2d69cb5c54a03ca38cc5c", "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/1771284cb43a7b653634d418b6f5f0ec84ff8a6d",
"reference": "df8ee73046c688ee9ce2d69cb5c54a03ca38cc5c", "reference": "1771284cb43a7b653634d418b6f5f0ec84ff8a6d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"elastic/transport": "^8.10", "elastic/transport": "^8.11",
"guzzlehttp/guzzle": "^7.0", "guzzlehttp/guzzle": "^7.0",
"php": "^7.4 || ^8.0", "php": "^7.4 || ^8.0",
"psr/http-client": "^1.0", "psr/http-client": "^1.0",
@ -117,9 +117,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/elastic/elasticsearch-php/issues", "issues": "https://github.com/elastic/elasticsearch-php/issues",
"source": "https://github.com/elastic/elasticsearch-php/tree/v8.18.0" "source": "https://github.com/elastic/elasticsearch-php/tree/v8.19.0"
}, },
"time": "2025-05-02T10:38:56+00:00" "time": "2025-08-06T16:58:06+00:00"
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",

16
src/connect-db.php Normal file
View File

@ -0,0 +1,16 @@
<?php
function connexionDB($host,$db,$user,$pass) {
$dsn = "mysql:host=$host;dbname=$db;charset=UTF8";
try {
$pdo = new PDO($dsn, $user, $pass, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // Mode erreur
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, // Mode de récupération
PDO::ATTR_EMULATE_PREPARES => false, // Préparation réelle des requêtes
]);
return $pdo;
} catch (PDOException $e) {
die("Erreur de connexion : " . $e->getMessage());
}
}
?>

View File

@ -1,15 +0,0 @@
<?php
require_once 'config.php';
function connect($host, $db, $user, $password)
{
$dsn = "mysql:host=$host;dbname=$db;charset=UTF8";
try {
$options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
return new PDO($dsn, $user, $password, $options);
} catch (PDOException $e) {
die($e->getMessage());
}
}

View File

@ -1,7 +1,8 @@
<?php <?php
require_once 'config.php'; require_once 'config.php';
// conection db // conection db
$conn = require 'connect.php'; require_once 'connect-db.php';
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@ -17,6 +18,8 @@ $conn = require 'connect.php';
<?php echo $site_copyright; echo "<hr>"; ?> <?php echo $site_copyright; echo "<hr>"; ?>
<?php <?php
$conn=connexionDB($host, $db, $user, $password);
//echo $conn;
// sql to create table // sql to create table
$sql = "CREATE TABLE IF NOT EXISTS $table ( $sql = "CREATE TABLE IF NOT EXISTS $table (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
@ -26,7 +29,6 @@ email VARCHAR(50) UNIQUE,
reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
mod_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP mod_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)"; )";
try { try {
$conn->query($sql); $conn->query($sql);
echo "<p>Table <b>".$table."</b> created successfully</p>"; echo "<p>Table <b>".$table."</b> created successfully</p>";

View File

@ -1,7 +1,7 @@
<?php <?php
require_once 'config.php'; require_once 'config.php';
// conection db // conection db
$conn = require 'connect.php'; require_once 'connect-db.php';
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@ -16,6 +16,10 @@ $conn = require 'connect.php';
<h2><?php echo $db_site_title ?></h2> <h2><?php echo $db_site_title ?></h2>
<?php echo $site_copyright; echo "<hr>"; ?> <?php echo $site_copyright; echo "<hr>"; ?>
<?php <?php
// connect to DB
$conn=connexionDB($host, $db, $user, $password);
// sql to create table // sql to create table
$sql = "DROP TABLE IF EXISTS $table;"; $sql = "DROP TABLE IF EXISTS $table;";

View File

@ -84,3 +84,4 @@ echo "<h3>MariaDB</h3>";
<?php echo "Nous sommes le $date, il est $time.\n"?></h6> <?php echo "Nous sommes le $date, il est $time.\n"?></h6>
</body> </body>
</html> </html>
<img src='http://gmoadm.gmolab.net:8085/images/trash.svg' alt='pen' />

View File

@ -2,7 +2,8 @@
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
require_once 'config.php'; require_once 'config.php';
// conection db // conection db
$conn=require 'connect.php'; require_once 'connect-db.php';
$conn=connexionDB($host, $db, $user, $password);
$defaultAction='add'; $defaultAction='add';
$defaultModCre=false; // display or not created/modified date $defaultModCre=false; // display or not created/modified date
@ -295,7 +296,7 @@ if (isset($_POST['displaymore'])) {
"<input type='hidden' name='email' value='".$email."'>". "<input type='hidden' name='email' value='".$email."'>".
"<input type='hidden' name='flagAction' value='modify'>". "<input type='hidden' name='flagAction' value='modify'>".
"<input type='hidden' name='id' value='".$id."'>". "<input type='hidden' name='id' value='".$id."'>".
"<button type='submit' name='modify' title='Modify'><img src='images/pen.svg' alt='pen' /></button>&nbsp;". "<button type='submit' name='modify' title='Modify'><img src='./images/pen.svg' alt='pen' /></button>&nbsp;".
"<button onclick='return validate(\"".$firstname." ".$lastname." (".$email.")\");' type='submit' name='delete' title='Delete'><img src='images/trash.svg' alt='trash' /></button>". "<button onclick='return validate(\"".$firstname." ".$lastname." (".$email.")\");' type='submit' name='delete' title='Delete'><img src='images/trash.svg' alt='trash' /></button>".
"</td></form></tr>"; "</td></form></tr>";
} }