Inital
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once(__DIR__ . "/../inc/config.inc.php");
|
||||
require_once(__DIR__ . "/../inc/functions.inc.php");
|
||||
include("templates/header.inc.php");
|
||||
?>
|
||||
<div class="container small-container-330">
|
||||
<h2 >Authentifizierung</h2>
|
||||
|
||||
|
||||
<?php
|
||||
$showForm = true;
|
||||
|
||||
|
||||
|
||||
if(isset($_GET['send']) ) {
|
||||
if(!isset($_SESSION['userid']) && !isset($_GET['userid'])) {
|
||||
$error = "<br><b>Fehler bei der Findung des Benutzers. Bitte anmelden und Formular erneut nutzen.</b>";
|
||||
} else {
|
||||
$statement = $pdo->prepare("SELECT * FROM intern_users WHERE id = :id");
|
||||
|
||||
if(isset($_SESSION['userid'])){
|
||||
$result = $statement->execute(array('id' => $_SESSION['userid']));
|
||||
}elseif(isset($_GET['userid'])){
|
||||
$result = $statement->execute(array('id' => $_GET['userid']));
|
||||
}
|
||||
$user = $statement->fetch();
|
||||
|
||||
if($user === false) {
|
||||
$error = "<b>Kein Benutzer gefunden</b>";
|
||||
} else {
|
||||
|
||||
$passwortcode = random_string();
|
||||
$statement = $pdo->prepare("UPDATE intern_users SET passwortcode = :passwortcode, passwortcode_time = NOW() WHERE id = :userid");
|
||||
$result = $statement->execute(array('passwortcode' => sha1($passwortcode), 'userid' => $user['id']));
|
||||
|
||||
$empfaenger = $user['email'];
|
||||
$betreff = "Authentifizierung für deinen Account auf ". $_SERVER['SERVER_NAME'];
|
||||
|
||||
$url_passwortcode = getSiteURL().'authentifizierung.php?userid='.$user['id'].'&code='.$passwortcode;
|
||||
$text = 'Hallo '.$user['vorname'].',<br><br>
|
||||
für die Nutzung des Kontos müssen Sie das Konto per E-Mail authentifizieren. Dazu klicken Sie auf den folgenden Link:<br>
|
||||
'.$url_passwortcode.'
|
||||
<br><br>
|
||||
Nach der Authentifizierung können Sie das Konto vollumfänglich nutzen.<br><br>
|
||||
Haben Sie keine Konto bei uns angelegt, ignorieren Sie diese E-Mail.<br><br>
|
||||
|
||||
Viele Grüße,<br>
|
||||
Ihr ' .$organisationsname . ' Team';
|
||||
|
||||
//echo $text;
|
||||
|
||||
$mailOk = SendMailMessage($pdo, $empfaenger, $betreff ,$text);
|
||||
|
||||
|
||||
echo "Ein Link, um Ihr Konto per E-Mail zu authentifizieren, wurde an deine E-Mail-Adresse gesendet.";
|
||||
$showForm = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($showForm):
|
||||
|
||||
if(check_mailreg()){
|
||||
echo 'Ihr konto ist schon authentifiziert.<br><br>';
|
||||
|
||||
}else{
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(isset($error) && !empty($error)) {
|
||||
echo $error;
|
||||
}else{
|
||||
|
||||
|
||||
?>
|
||||
Klicken Sie auf "E-Mail anfordern", um die Authentifizierung per E-Mail für Ihr Konto zu starten.<br><br>
|
||||
|
||||
|
||||
<form action="?send=1" method="post">
|
||||
<input class="btn btn-lg btn-primary btn-block" name="submit" type="submit" value="E-Mail anfordern">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
endif; //Endif von if($showForm)
|
||||
|
||||
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