92 lines
3.4 KiB
PHP
92 lines
3.4 KiB
PHP
<?php
|
|
require_once("config/participo.php");
|
|
|
|
require_once("participoLib/participo.php");
|
|
|
|
require_once("./local/dbConf.php");
|
|
|
|
require_once($config['basePath']."/config/cwsvJudo.config.php");
|
|
dbConnector::connect(
|
|
$cwsvJudoConfig["db"]["host"],
|
|
$cwsvJudoConfig["db"]["name"],
|
|
$cwsvJudoConfig["db"]["user"],
|
|
$cwsvJudoConfig["db"]["password"]
|
|
);
|
|
|
|
// Check, if the login is already set. If so move to the main page
|
|
if (isset($_SESSION['login'])) {
|
|
header("Location: http://" . ($_POST['returnToUrl'] ?? "."), TRUE, 301);
|
|
}
|
|
// Otherwise check credentials if given.
|
|
else{
|
|
if (!empty($_POST)) {
|
|
if (
|
|
empty($_POST['f']['username']) ||
|
|
empty($_POST['f']['password'])
|
|
) {
|
|
$message = ['error' => "Es wurden nicht alle Felder ausgefüllt."];
|
|
} else {
|
|
if( participo::checkCredentials( $_POST['f']['username'], $_POST['f']['password']) ){
|
|
$returnToUrl = ($_POST['returnToUrl'] ?? ".").($_POST['fragment'] ?? "");
|
|
participo::addMessage('success', "<div><a href=\"".$returnToUrl."\">weiter zum Inhalt</a>.</div>");
|
|
participo::addMessage('notice', "OnlineApps - cwsvJudo");
|
|
header("Location: " . $returnToUrl, TRUE, 301 );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
<!-- includes of neccessary libs -->
|
|
<?php readfile("./shared/imports.php");?>
|
|
|
|
<title>cwsvJudo Online Apps</title>
|
|
<meta name="description" content="Loginseite der Online-Apps der Judoka des CWSV">
|
|
</head>
|
|
<body class="container">
|
|
<h1>Loginseite der Online-Apps der Judoka des CWSV</h1>
|
|
<?php echo(htmlRetMessage(participo::getMessages()));?>
|
|
<form action="./login.php" method="post">
|
|
<fieldset>
|
|
<legend>Benutzerdaten</legend>
|
|
<div>
|
|
<label for="username">Benutzername</label>
|
|
<input id="username" type="text" name="f[username]" <?php echo isset($_POST['f']['username']) ? ' value="' . htmlspecialchars($_POST['f']['username']) . '"' : '' ?> />
|
|
</div>
|
|
<div>
|
|
<label for="password">Kennnwort</label>
|
|
<input id="password" type="password" name="f[password]" />
|
|
</div>
|
|
<?php if( isset( $_GET['returnToUrl']) ) echo("<input type=\"hidden\" name=\"returnToUrl\" value=\"".htmlspecialchars( $_GET['returnToUrl'])."\" />"); ?>
|
|
<?php if( isset($_POST['returnToUrl']) ) echo("<input type=\"hidden\" name=\"returnToUrl\" value=\"".htmlspecialchars($_POST['returnToUrl'])."\" />"); ?>
|
|
<input id="fragment" type="hidden" name="fragment" />
|
|
<!-- add the fragment to the post data-->
|
|
<script>
|
|
if(window.location.hash){
|
|
document.getElementById("fragment").value=window.location.hash;
|
|
}
|
|
</script>
|
|
|
|
</fieldset>
|
|
<fieldset>
|
|
<div>
|
|
<button type="submit" name="submit" value="Anmelden">Anmelden</button>
|
|
</div>
|
|
</fieldset>
|
|
<fieldset class="notice"><legend>Hinweise</legend>
|
|
<ul style="padding-left: inherit;">
|
|
<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>
|
|
</form>
|
|
</body>
|
|
</html>
|