Files
praxis-creutzburg-web/intern/mailtemplatebody.php
T
2026-03-20 17:13:38 +01:00

60 lines
2.5 KiB
PHP

<?php
include('../impfconfig.php');
// E-Mail Vorlage laden
$templetid = $_POST["templetid"];
$anfrageid = $_POST["anfrageid"];
$queryconfig = mysqli_query($con, "Select betreff,body,name FROM mailtemplates WHERE templetid='$templetid' ");
$rowconfig = mysqli_fetch_assoc($queryconfig);
$body = $rowconfig["body"];
$betreff = $rowconfig["betreff"];
$name = $rowconfig["name"];
$sqlstring = "SELECT * FROM anfragen INNER JOIN user ON anfragen.personid = user.userid WHERE anfrageid ='" . $anfrageid . "'";
$query = mysqli_query($con,$sqlstring);
$rowtime = mysqli_fetch_assoc($query);
$vorname = $rowtime["vorname"];
$nachname = $rowtime["nachname"];
$geburtstag = $rowtime["geburtstag"];
$tele = $rowtime["tele"];
$plz = $rowtime["plz"];
$ort = $rowtime["ort"];
$strasse = $rowtime["strasse"];
$adresse = "$ort $plz, $stasse";
$empfaenger = $rowtime["mail"];
$hash = $rowtime["hash"];
$timeid = $rowtime["timeid"];
$userausgabe = $vorname . " " . $nachname;
$anfragenlogin = $anfragebestaetigung . "?id=" . $hash ;
$nachricht = $rowtime["nachricht"];
$medikamenteins = $rowtime["medikament1"];
$medikamentzwei = $rowtime["medikament2"];
$anforderungart = $rowtime["anforderungart"];
$sqlimpfstoffstring = "SELECT artname FROM anfrageart WHERE artid ='" . $anforderungart . "'";
$queryimpfstoff = mysqli_query($con,$sqlimpfstoffstring);
$rowimpf = mysqli_fetch_assoc($queryimpfstoff);
$rezeptart = $rowimpf["artname"];
$body = str_replace("%BENUTZERVORNAME%", $vorname, $body);
$body = str_replace("%BENUTZERNACHNAME%", $nachname, $body);
$body = str_replace("%BENUTZERGEBURTSTAG%", $geburtstag, $body);
$body = str_replace("%BENUTZERADRESSE%", $adresse, $body);
$body = str_replace("%TERMINZEITVORGABE%", $Zeitanzeige, $body);
$body = str_replace("%TERMINIMPFSTOFF%", $impfstofftext, $body);
$body = str_replace("%TERMINLOGIN%", $terminlogin, $body);
$body = str_replace("%WARTELISTELOGIN%", $wartelistelogin, $body);
$body = str_replace("%WARTELISTEIMPFSTOFF%", $impfstofftextwarte, $body);
$body = str_replace("%WARTELISTEIMPFANGEBOT%", $impfangebottext, $body);
$body = str_replace("%REZEPTART%", $rezeptart, $body);
$body = str_replace("%MEDIKAMENTNUMMEREINS%", $medikamenteins, $body);
$body = str_replace("%MEDIKAMENTNUMMERZWEI%", $medikamentzwei, $body);
$body = str_replace("%ANFRAGENACHRICHT%", $nachricht, $body);
$body = str_replace("%ANFRAGENLOGIN%", $anfragenlogin, $body);
$betreff = iconv('CP1252//IGNORE', 'UTF-8' , $betreff);
$body = iconv('CP1252//IGNORE', 'UTF-8' , $body);
echo $body;
?>