WIP: first error free login

This commit is contained in:
marko
2024-07-22 05:37:58 +02:00
parent 34435d570a
commit 466911a5c6
12 changed files with 30 additions and 14 deletions

View File

@@ -1,2 +1,2 @@
<?
phpinfo();
echo __DIR__;

View File

@@ -12,4 +12,4 @@ $query = $pdo->query('SHOW VARIABLES like "version"');
$row = $query->fetch();
echo 'MYSQL version: '. $row['Value'];
echo 'MYSQL version: '. $row['Value'];

View File

@@ -0,0 +1,3 @@
order deny,allow
deny from all
allow from localhost

View File

@@ -10,20 +10,20 @@ require_once 'local/cwsvJudo.php';
// legacy lib usage
// @todo remove unused libraries
// require_once 'db.php'; // should be replaced
require_once 'db.php'; // should be replaced
// require_once 'api.php'; // should be replaced
// libraries
require_once 'participoLib/participo.php';
require_once 'participoLib/planer.php';
require_once 'participoLib/apiKey.php';
// require_once 'phpcount/phpcount.php';
// Add page hit
// PHPCount::AddHit('participo');
// init the db connector
// var_dump($cwsvJudoConfig);
dbConnector::connect(
$cwsvJudoConfig['db']['host'],
$cwsvJudoConfig['db']['name'],
@@ -31,7 +31,7 @@ dbConnector::connect(
$cwsvJudoConfig['db']['password']
);
// authentication of the current user
// authentication of the current user
participo::authentificate();
// load the userData

View File

@@ -68,7 +68,7 @@ if( empty($someOptions['dontFetch' ]) ) $someOptions['dontFetch' ] = false;
array_walk(
$entry,
function (&$value, $key, $someOptions) {
$value = iconv($someOptions['dbCharset'], $someOptions['outCharset'], $value);
$value = isset($value) ? iconv($someOptions['dbCharset'], $someOptions['outCharset'], $value) : $value;
},
$someOptions
);

View File

@@ -86,7 +86,7 @@ class dbConnector
array_walk(
$entry,
function (&$value, $key, $someOptions) {
$value = iconv($someOptions['dbCharset'], $someOptions['outCharset'], $value);
$value = isset($value) ? iconv($someOptions['dbCharset'], $someOptions['outCharset'], $value) : $value;
},
$someOptions
);

View File

@@ -311,7 +311,8 @@ class Event
public static function fromDbArray($member)
{
$shiai = json_decode($member['bemerkungen'], true);
$shiai = isset($member["bemerkungen"]) ? json_decode($member['bemerkungen'], true) : null;
return new event(
$member['id'] ?? null,

View File

@@ -284,8 +284,8 @@ class User
$member[$columnMappings['vorname']] ?? null,
$member[$columnMappings['gebDatum']] ?? null,
array_key_exists($columnMappings['eMail'], $member) ? explode(',', $member['eMail']) : null,
array_key_exists($columnMappings['config'], $member) ? json_decode($member['config']) : null,
array_key_exists($columnMappings['pwHash'], $member) ? $member['pwHash'] : null
array_key_exists($columnMappings['config'], $member) && isset($member[$columnMappings['config']]) ? json_decode($member[$columnMappings['config']]) : null,
array_key_exists($columnMappings['pwHash'], $member) ? $member[$columnMappings['pwHash']] : null
);
}

View File

@@ -7,7 +7,8 @@ require_once 'participoLib/apiKey.php';
require_once './local/dbConf.php';
require_once $config['basePath'] . '/config/cwsvJudo.config.php';
dbConnector::connect(
$dbConnection = dbConnector::connect(
$cwsvJudoConfig['db']['host'],
$cwsvJudoConfig['db']['name'],
$cwsvJudoConfig['db']['user'],

View File

@@ -0,0 +1,2 @@
<?
phpinfo();

View File

@@ -36,6 +36,7 @@ services:
# define environment variables
# @todo Should credentials be placed here? Even if it is just a test environment
environment:
# MYSQL_TCP_PORT: 1433
MYSQL_USER: 'cwsvjudo'
MYSQL_DATABASE: 'cwsvjudo'
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password
@@ -43,7 +44,7 @@ services:
volumes:
- mysqldata:/var/lib/mysql
# initial database
# - has to be created first, e.g., by dumping the database from the prooductive system
# - has to be created first, e.g., by dumping the database from the productive system
- ./cwsvjudo.sql:/docker-entrypoint-initdb.d/cwsvjudo.sql
secrets:
@@ -60,8 +61,7 @@ services:
environment:
# name of the host is the name of the db service started above! Why? I don't know!
- PMA_HOST=database
- PMA_PORT=3306
# - PMA_ARBITRARY=1
- PMA_PORT=1433
volumes:
# data storage for the db
mysqldata: {}

View File

@@ -5,6 +5,15 @@ server {
index index.php index.html index.htm;
location / {
# rewrite rules
# - add php to requested filename if it exists
if (-e $request_filename.php) {
rewrite ^/(.*)$ /$1.php last;
break;
}
}
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;