own hosted material icons
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
# Url-Rewriting aktivieren
|
||||
RewriteEngine on
|
||||
# Wenn * angefordert wurde und *.php existiert
|
||||
|
||||
# Wenn * angefordert wurde und *.php existiert ..
|
||||
RewriteCond %{REQUEST_FILENAME}.php -f
|
||||
# Hänge ein \.php an
|
||||
# .. hänge ein \.php an
|
||||
RewriteRule ^(.*)$ $1\.php
|
||||
|
||||
|
||||
@@ -197,7 +197,8 @@ function isUserInKidIds($uId, $idList){
|
||||
|
||||
|
||||
// @todo: Achtung, als id ist die id der Vormundschaft gespeichert. Unter kidId die des Kindes.
|
||||
function getUsersKids($db, $userId){
|
||||
function getUsersKids($db, $userId, $options = []){
|
||||
options['attribute'] ??
|
||||
$query = <<<SQL
|
||||
SELECT *
|
||||
FROM `wkParticipo_Users`
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<?php
|
||||
|
||||
class participo{
|
||||
private static $db = null;
|
||||
static public function initDbConnection(){}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action element of an MaterializeCss (App-)card
|
||||
*/
|
||||
@@ -126,35 +133,35 @@ function lastLoginTable($jsonFileName="lastLogins.json"){
|
||||
|
||||
/// Eine Fehler/Warnung/Notiz/Erfolgsmeldung als divBox im String zurückgeben
|
||||
function htmlRetMessage($anRetMessage){
|
||||
$retHtmlString = "";
|
||||
if( !empty($anRetMessage) ){
|
||||
$retHtmlString .= "<div style=\"border: 1px solid;\">";
|
||||
if( !empty($anRetMessage['error']) ){
|
||||
$retHtmlString = "";
|
||||
if( !empty($anRetMessage) ){
|
||||
$retHtmlString .= "<div style=\"border: 1px solid;\">";
|
||||
$retHtmlString .= "ERROR:<br />";
|
||||
$retHtmlString .= $anRetMessage['error'];
|
||||
if( !empty($anRetMessage['error']) ){
|
||||
$retHtmlString .= "<div style=\"border: 1px solid;\">";
|
||||
$retHtmlString .= "ERROR:<br />";
|
||||
$retHtmlString .= $anRetMessage['error'];
|
||||
$retHtmlString .= "</div>";
|
||||
}
|
||||
if( !empty($anRetMessage['warning']) ){
|
||||
$retHtmlString .= "<div style=\"border: 1px solid;\">";
|
||||
$retHtmlString .= "WARNING:<br />";
|
||||
$retHtmlString .= $anRetMessage['warning'];
|
||||
$retHtmlString .= "</div>";
|
||||
}
|
||||
if( !empty($anRetMessage['notice']) ){
|
||||
$retHtmlString .= "<div style=\"border: 1px solid;\">";
|
||||
$retHtmlString .= "Info:<br />";
|
||||
$retHtmlString .= $anRetMessage['notice'];
|
||||
$retHtmlString .= "</div>";
|
||||
}
|
||||
if( !empty($anRetMessage['success']) ){
|
||||
$retHtmlString .= "<div style=\"border: 1px solid;\">";
|
||||
$retHtmlString .= "SUCCESS:<br />";
|
||||
$retHtmlString .= $anRetMessage['success'];
|
||||
$retHtmlString .= "</div>";
|
||||
}
|
||||
$retHtmlString .= "</div>";
|
||||
}
|
||||
if( !empty($anRetMessage['warning']) ){
|
||||
$retHtmlString .= "<div style=\"border: 1px solid;\">";
|
||||
$retHtmlString .= "WARNING:<br />";
|
||||
$retHtmlString .= $anRetMessage['warning'];
|
||||
$retHtmlString .= "</div>";
|
||||
}
|
||||
if( !empty($anRetMessage['notice']) ){
|
||||
$retHtmlString .= "<div style=\"border: 1px solid;\">";
|
||||
$retHtmlString .= "Info:<br />";
|
||||
$retHtmlString .= $anRetMessage['notice'];
|
||||
$retHtmlString .= "</div>";
|
||||
}
|
||||
if( !empty($anRetMessage['success']) ){
|
||||
$retHtmlString .= "<div style=\"border: 1px solid;\">";
|
||||
$retHtmlString .= "SUCCESS:<br />";
|
||||
$retHtmlString .= $anRetMessage['success'];
|
||||
$retHtmlString .= "</div>";
|
||||
}
|
||||
$retHtmlString .= "</div>";
|
||||
}
|
||||
return $retHtmlString;
|
||||
}
|
||||
|
||||
@@ -205,4 +212,65 @@ function loadMarkdownFile($fileName){
|
||||
, 'mdText' => $mdText
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function checkCredentials($username, $password, $db_server, $db_user, $db_password, $db_name){
|
||||
sleep(1);
|
||||
$mysqli = @new mysqli($db_server, $db_user, $db_password, $db_name);
|
||||
if ($mysqli->connect_error) {
|
||||
$message['error'] = 'Datenbankverbindung fehlgeschlagen: ' . $mysqli->connect_error;
|
||||
} else {
|
||||
$query = sprintf(
|
||||
"SELECT id, loginName, pwHash, config FROM wkParticipo_Users WHERE loginName = '%s'",
|
||||
$mysqli->real_escape_string($_POST['f']['username'])
|
||||
);
|
||||
$result = $mysqli->query($query);
|
||||
if ($row = $result->fetch_array(MYSQLI_ASSOC)) {
|
||||
if( password_verify( $_POST['f']['password'], $row['pwHash']) ){
|
||||
session_start();
|
||||
$_SESSION = array(
|
||||
'login' => true,
|
||||
'user' => array(
|
||||
'username' => $row['loginName'],
|
||||
'userId' => $row['id'],
|
||||
'userConfig' => json_decode($row['config'], true)
|
||||
),
|
||||
);
|
||||
$message['success'] = 'Anmeldung erfolgreich, <a href="index.php">weiter zum Inhalt</a>.';
|
||||
|
||||
// Logging Logins
|
||||
logLoginsToJsonFile($_SESSION['user']['username']);
|
||||
|
||||
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/participo?user=' . $_POST['f']['username']);
|
||||
} else {
|
||||
sleep(5);
|
||||
$message['error'] = 'Das Kennwort ist nicht korrekt.';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the Login of an user into a logFile
|
||||
*
|
||||
* @param string $userName name of the user
|
||||
* @param string $fileName filename to log to
|
||||
* @return void
|
||||
*/
|
||||
function logLoginsToJsonFile($userName, $fileName="lastLogins.json"){
|
||||
try{
|
||||
$lastLogins = json_decode(file_get_contents($fileName), true);
|
||||
if(!array_key_exists($userName, $lastLogins))
|
||||
$lastLogins[$userName] = [];
|
||||
if(!array_key_exists('lastLogins', $lastLogins[$userName]))
|
||||
$lastLogins[$userName]['lastLogins'] = [];
|
||||
$lastLogins[$userName]['lastLogins'] = array_merge( array( date('Y-m-d H:i:s') ), $lastLogins[$userName]['lastLogins'] );
|
||||
file_put_contents($fileName, json_encode($lastLogins));
|
||||
}
|
||||
catch (Exception $e){
|
||||
// silently ignore errors
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,79 +1,16 @@
|
||||
<?php
|
||||
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
|
||||
require_once("lib/participoLib/participo.php");
|
||||
require_once("lib/participoLib/participo.php");
|
||||
require_once("config/participo.php");
|
||||
|
||||
require_once("./local/dbConf.php");
|
||||
|
||||
$basePath = $config['basePath'];
|
||||
require_once($basePath."/config/phpcount.config.php");
|
||||
require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
|
||||
|
||||
|
||||
function checkCredentials($username, $password, $db_server, $db_user, $db_password, $db_name){
|
||||
sleep(1);
|
||||
$mysqli = @new mysqli($db_server, $db_user, $db_password, $db_name);
|
||||
if ($mysqli->connect_error) {
|
||||
$message['error'] = 'Datenbankverbindung fehlgeschlagen: ' . $mysqli->connect_error;
|
||||
} else {
|
||||
$query = sprintf(
|
||||
"SELECT id, loginName, pwHash, config FROM wkParticipo_Users WHERE loginName = '%s'",
|
||||
$mysqli->real_escape_string($_POST['f']['username'])
|
||||
);
|
||||
$result = $mysqli->query($query);
|
||||
if ($row = $result->fetch_array(MYSQLI_ASSOC)) {
|
||||
if( password_verify( $_POST['f']['password'], $row['pwHash']) ){
|
||||
session_start();
|
||||
$_SESSION = array(
|
||||
'login' => true,
|
||||
'user' => array(
|
||||
'username' => $row['loginName'],
|
||||
'userId' => $row['id'],
|
||||
'userConfig' => json_decode($row['config'], true)
|
||||
),
|
||||
);
|
||||
$message['success'] = 'Anmeldung erfolgreich, <a href="index.php">weiter zum Inhalt</a>.';
|
||||
PHPCount::AddHit("participo-Login-".$_POST['f']['username']);
|
||||
|
||||
// Logging Logins
|
||||
logLoginsToJsonFile($_SESSION['user']['username']);
|
||||
|
||||
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/participo?user=' . $_POST['f']['username']);
|
||||
} else {
|
||||
sleep(5);
|
||||
$message['error'] = 'Das Kennwort ist nicht korrekt.';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the Login of an user into a logFile
|
||||
*
|
||||
* @param string $userName name of the user
|
||||
* @param string $fileName filename to log to
|
||||
* @return void
|
||||
*/
|
||||
function logLoginsToJsonFile($userName, $fileName="lastLogins.json"){
|
||||
try{
|
||||
$lastLogins = json_decode(file_get_contents($fileName), true);
|
||||
if(!array_key_exists($userName, $lastLogins))
|
||||
$lastLogins[$userName] = [];
|
||||
if(!array_key_exists('lastLogins', $lastLogins[$userName]))
|
||||
$lastLogins[$userName]['lastLogins'] = [];
|
||||
$lastLogins[$userName]['lastLogins'] = array_merge( array( date('Y-m-d H:i:s') ), $lastLogins[$userName]['lastLogins'] );
|
||||
file_put_contents($fileName, json_encode($lastLogins));
|
||||
}
|
||||
catch (Exception $e){
|
||||
// silently ignore errors
|
||||
}
|
||||
}
|
||||
|
||||
// Check, if the login is already set. If so move to the main page.
|
||||
if (isset($_SESSION['login'])) {
|
||||
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php');
|
||||
}
|
||||
// Otherwise check credentials if given.
|
||||
else{
|
||||
if (!empty($_POST)) {
|
||||
if (
|
||||
@@ -103,7 +40,7 @@ else{
|
||||
<title>cwsvJudo Online Apps</title>
|
||||
<meta name="description" content="Loginseite der Online-Apps der Judoka des CWSV">
|
||||
</head>
|
||||
<body class="container">
|
||||
<body class="container">
|
||||
<h1>Loginseite der Online-Apps der Judoka des CWSV</h1>
|
||||
<?php echo(htmlRetMessage($message));?>
|
||||
<form action="./login.php" method="post">
|
||||
@@ -125,7 +62,8 @@ else{
|
||||
</fieldset>
|
||||
<fieldset class="notice"><legend>Hinweise</legend>
|
||||
<ul style="padding-left: inherit;">
|
||||
<li style="list-style-type: circle;" >Logindaten sind über den Übungsleiter zu beantragen.</li>
|
||||
<li style="list-style-type: circle;" >Logindaten sollten vom Übungsleiter vergeben worden sein.</li>
|
||||
<ul><li style="list-style-type: circle;">Verlorene oder vergessene Logins oder Passwörter können über den Übungsleiter neu vergeben werden.</li></ul>
|
||||
<li style="list-style-type: circle;" >Dieses Projekt ist in mehr oder weniger aktiven Entwicklung. Sollte mal was nicht funktionieren, kann es sein, dass ich gerade daran herumschreibe. Also ruhig zu einem späteren Zeitpunkt noch einmal probieren.</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
Reference in New Issue
Block a user