Inital
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once(__DIR__ . "/../inc/config.inc.php");
|
||||
require_once(__DIR__ . "/../inc/functions.inc.php");
|
||||
|
||||
|
||||
if(!isset($_GET['userid']) || !isset($_GET['code'])) {
|
||||
error("Leider wurde beim Aufruf dieser Website kein Code übermittelt");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$showForm = true;
|
||||
$userid = $_GET['userid'];
|
||||
$code = $_GET['code'];
|
||||
|
||||
//Abfrage des Nutzers
|
||||
$statement = $pdo->prepare("SELECT * FROM intern_users WHERE id = :userid");
|
||||
$result = $statement->execute(array('userid' => $userid));
|
||||
$user = $statement->fetch();
|
||||
|
||||
//Überprüfe dass ein Nutzer gefunden wurde und dieser auch ein Authentifizierungscode angefordert hat
|
||||
if($user === null || $user['passwortcode'] === null) {
|
||||
error("Der Benutzer wurde nicht gefunden oder hat kein ein Authentifizierungscode angefordert.");
|
||||
$showForm = false;
|
||||
}
|
||||
|
||||
if($user['passwortcode_time'] === null || strtotime($user['passwortcode_time']) < (time()-24*3600) ) {
|
||||
error("Dein Code ist leider abgelaufen. Bitte benutze die Authentifizierungsfunktion erneut.");
|
||||
$showForm = false;
|
||||
}
|
||||
|
||||
|
||||
//Überprüfe den Passwortcode
|
||||
if(sha1($code) != $user['passwortcode']) {
|
||||
error("Der übergebene Code war ungültig. Stell sicher, dass du den genauen Link in der URL aufgerufen hast. Solltest du mehrmals die Authentifizierungsfunktion genutzt haben, so ruf den Link in der neuesten E-Mail auf.");
|
||||
$showForm = false;
|
||||
}
|
||||
|
||||
|
||||
include("templates/header.inc.php");
|
||||
?>
|
||||
|
||||
<div class="container small-container-500">
|
||||
|
||||
<h1>Authentifizierung</h1>
|
||||
<?php
|
||||
|
||||
if(check_mailreg()){
|
||||
echo "<p>Ihr Benutzerkonto ist schon authentifiziert.</p>";
|
||||
|
||||
}elseif($showForm){
|
||||
|
||||
$passworthash = password_hash($passwort, PASSWORD_DEFAULT);
|
||||
$statement = $pdo->prepare("UPDATE intern_users SET mailreg='1', passwortcode = NULL, passwortcode_time = NULL WHERE id = :userid");
|
||||
$result = $statement->execute(array('userid'=> $userid ));
|
||||
|
||||
if($result) {
|
||||
$msg = "<p>Die Authentifizierung Ihre Kontos wurde erfolgreich abgeschlossen.</p>";
|
||||
$showForm = false;
|
||||
}
|
||||
|
||||
}else{
|
||||
echo "<p>Die Authentifizierungsfunktion steht mit den angegebenen Daten nicht zur Verfügung.</p>";
|
||||
|
||||
}
|
||||
|
||||
if(isset($msg)) {
|
||||
echo $msg;
|
||||
}
|
||||
|
||||
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
echo "<form action='index.php' method=POST>";
|
||||
echo "<input name=aktion type=hidden value=1>";
|
||||
echo "<input type=submit class='btn btn-primary' value='Zurück'><br>";
|
||||
echo '</form>';
|
||||
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
?>
|
||||
|
||||
</div> <!-- /container -->
|
||||
|
||||
|
||||
<?php
|
||||
include("templates/footer.inc.php")
|
||||
?>
|
||||
Reference in New Issue
Block a user