218 lines
7.4 KiB
PHP
218 lines
7.4 KiB
PHP
<?php
|
|
|
|
// Include config file
|
|
require_once "config.php";
|
|
$config = parse_ini_file("config.ini", true) ;
|
|
$baseURL = $config['base']['URL'];
|
|
session_start();
|
|
|
|
$firstname = isset($_SESSION['firstname']) ? $_SESSION['firstname'] : "Roland";
|
|
$lastname = isset($_SESSION['lastname']) ? $_SESSION['lastname'] : "Keck";
|
|
$email = isset($_SESSION['email']) ? $_SESSION['email'] : "roland.keck@conlicom.de";
|
|
$userToken = isset($_SESSION['userToken']) ? $_SESSION['userToken'] : "4711";
|
|
|
|
$replyto = "noreply@bibb-service.de";
|
|
$resetpassword_link =$baseURL . "/resetpassword.php?token=" . $userToken;
|
|
|
|
$subject = '=?UTF-8?B?' . base64_encode('Passwort zurücksetzen im Publikationskonto des VET Repository') . '?=';
|
|
|
|
define("DEFCALLBACKMAIL", $replyto); // Will be shown as "from".
|
|
|
|
// Mailtext as HTML (necessary because of the links used in the Mail
|
|
$html = "<html>
|
|
<head>
|
|
<title>Passwort zurücksetzen im Publikationskonto des VET Repository</title>
|
|
<meta charset='UTF-8'>
|
|
</head>
|
|
<body style='font-family: Arial, sans-serif; font-size: 14px;'>";
|
|
|
|
//falls doch noch einmal LOGO benötigt wird
|
|
// <img src='vet_repository.png' width='85' height='30' alt='VET Repository Logo'>
|
|
// <p> </p>
|
|
|
|
$html .= "
|
|
<p>Hallo {$firstname} {$lastname}, </p>
|
|
|
|
<p>wir haben alles vorbereitet, damit Sie Ihr Passwort für Ihr Publikationskonto zurücksetzen können, indem Sie auf diesen <a href='{$resetpassword_link}'>Link</a> klicken.
|
|
</p>
|
|
<p>Sollte der oben aufgeführte Link nicht funktionieren, kopieren Sie den Link {$resetpassword_link} in die Adresszeile Ihres Browsers.</p>
|
|
|
|
<p>Sie werden auf eine Seite weitergeleitet, auf der Sie Ihr Passwort neu vergeben können.</p>
|
|
|
|
<p>Bei weiteren Fragen stehen wir Ihnen gerne unter der Mailadresse <a href=\"mailto:repository@bibb.de\">repository@bibb.de</a> zur Verfügung.<br>
|
|
</p>
|
|
<p>Ihr Team des VET Repository</p>
|
|
<p>
|
|
<small>
|
|
--
|
|
<br>
|
|
Bundesinstitut für Berufsbildung
|
|
<br>
|
|
Stabsstelle \"Publikationen und wissenschaftliche Informationsdienste\"
|
|
<br>
|
|
Federal Institute for Vocational Education and Training (BIBB)
|
|
<br>
|
|
Strategic office \"Publications and Scientific Information Services\"
|
|
<br>
|
|
Friedrich-Ebert-Allee 114 - 116
|
|
<br>
|
|
D-53113 Bonn
|
|
<br><br>
|
|
<a href=\"mailto:repository@bibb.de\">repository@bibb.de</a>
|
|
<br>
|
|
<a href=\"https://www.bibb.de\">www.bibb.de</a>
|
|
<br>
|
|
<a href=\"https://www.bibb.de/repository\">www.bibb.de/repository</a>
|
|
<br>
|
|
<a href=\"https://www.vet-repository.info\">www.vet-repository.info</a>
|
|
<br>
|
|
</small>
|
|
</body>
|
|
</html>
|
|
";
|
|
|
|
|
|
// now let`s generate the mail including all links, images, etc.
|
|
$final_msg = preparehtmlmail($html); // give a function your html*
|
|
$message = $final_msg['multipart'];
|
|
$headers = $final_msg['headers'];
|
|
|
|
// send the mail using sendmail as underlying service
|
|
mail($email, $subject, $message, $headers);
|
|
|
|
|
|
// prepare email with all images from html attached (will be presented embedded depending on the Mailclient used
|
|
function preparehtmlmail($html) {
|
|
|
|
preg_match_all('~<img.*?src=.([\/.a-z0-9:_-]+).*?>~si',$html,$matches);
|
|
$i = 0;
|
|
$paths = array();
|
|
|
|
foreach ($matches[1] as $img) {
|
|
$img_old = $img;
|
|
|
|
if(strpos($img, "http://") === false || strpos($img, "https://")) {
|
|
$uri = parse_url($img);
|
|
$paths[$i]['path'] = $_SERVER['DOCUMENT_ROOT'].$uri['path'];
|
|
$content_id = md5($img);
|
|
$html = str_replace($img_old,'cid:'.$content_id,$html);
|
|
// print_r($html);
|
|
$paths[$i++]['cid'] = $content_id;
|
|
}
|
|
}
|
|
|
|
$boundary = "--".md5(uniqid(time()));
|
|
$headers = "MIME-Version: 1.0\n";
|
|
$headers .="Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
|
|
$headers .= "From: ".DEFCALLBACKMAIL."\r\n";
|
|
$multipart = '';
|
|
$multipart .= "--$boundary\n";
|
|
$kod = 'utf-8';
|
|
$multipart .= "Content-Type: text/html; charset=$kod\n";
|
|
$multipart .= "Content-Transfer-Encoding: Quot-Printed\n\n";
|
|
$multipart .= $html ."\n\n";
|
|
|
|
foreach ($paths as $path) {
|
|
if(file_exists($path['path']))
|
|
$fp = fopen($path['path'],"r");
|
|
if (!$fp) {
|
|
return false;
|
|
}
|
|
|
|
$imagetype = substr(strrchr($path['path'], '.' ),1);
|
|
$file = fread($fp, filesize($path['path']));
|
|
fclose($fp);
|
|
|
|
$message_part = "";
|
|
|
|
switch (strtolower($imagetype)) {
|
|
case 'png':
|
|
$message_part .= "Content-Type: image/png";
|
|
break;
|
|
case 'jpg':
|
|
case 'jpeg':
|
|
$message_part .= "Content-Type: image/jpeg";
|
|
break;
|
|
case 'gif':
|
|
$message_part .= "Content-Type: image/gif";
|
|
break;
|
|
}
|
|
|
|
$p = $path['path'];
|
|
$message_part .= "; file_name = \"$p\"\n";
|
|
$message_part .= 'Content-ID: <'.$path['cid'].">\n";
|
|
$message_part .= "Content-Transfer-Encoding: base64\n";
|
|
$message_part .= "Content-Disposition: inline; filename = \"".basename($path['path'])."\"\n\n";
|
|
$message_part .= chunk_split(base64_encode($file))."\n";
|
|
$multipart .= "--$boundary\n".$message_part."\n";
|
|
}
|
|
|
|
$multipart .= "--$boundary--\n";
|
|
return array('multipart' => $multipart, 'headers' => $headers);
|
|
}
|
|
?>
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Login</title>
|
|
|
|
<!-- Bootstrap 5 CSS && Bootstrap Icons -->
|
|
<?php include "include/includeJSandCSS.php" ?>
|
|
|
|
<!-- Custom CSS -->
|
|
<link href="css/bibb.css" media="all" rel="stylesheet" type="text/css">
|
|
|
|
<style>
|
|
html, body {
|
|
height: 100%;
|
|
}
|
|
|
|
.stickywrapper {
|
|
min-height: 60vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.content {
|
|
flex: 1;
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php include "templates/headerLogin.php"; ?>
|
|
|
|
<div class="stickywrapper">
|
|
<!-- Hauptinhalt der Seite -->
|
|
<div class="content">
|
|
<div class="container my-5">
|
|
<div id="confirmationScreen" class="wrapperconfirmation ml-10 shadow p-3 mb-5 bg-box rounded align-items-center">
|
|
<h4>E-Mail-Bestätigung Passwort zurücksetzen</h4>
|
|
<div class="pt-3 pb-3">
|
|
Hallo <?php echo $firstname ." " .$lastname ?>,
|
|
</div>
|
|
<div class="pb-3">
|
|
wir haben an die E-Mail-Adresse <?php echo $email ?> eine E-Mail mit dem Betreff "Passwort zurücksetzen im Publikationskonto des VET Repository" gesendet.
|
|
</div>
|
|
<div class="pb-3">
|
|
Bitte klicken Sie auf den Link in dieser E-Mail, damit wir Ihr Passwort zurücksetzen können.
|
|
</div>
|
|
<div>
|
|
Sollten Sie diese E-Mail nicht innerhalb kurzer Zeit erhalten, prüfen Sie bitte Ihren Spamordner. Ist die E-Mail auch dort nicht angekommen, melden Sie sich bitte über unser <a href="https://www.bibb.de/dienst/kontakt/de/kontaktformular.php?maid=4841" target="_blank" rel="noopener noreferrer" >Kontaktformular</a>.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include "templates/stickyfooter.php" ?>
|
|
|
|
</body>
|
|
</html>
|
|
|