Abgleich mit Live-Daten
This commit is contained in:
+161
-161
@@ -1,162 +1,162 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include_once("inc/config.inc.php");
|
||||
|
||||
|
||||
// Wenn das Formular abgesendet wird
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
$first_name = $_POST['first_name'];
|
||||
$last_name = $_POST['last_name'];
|
||||
$birthdate = $_POST['birthdate'];
|
||||
|
||||
// Erstelle den unique_key
|
||||
$unique_key = substr($first_name, 0, 2) . substr($last_name, 0, 2) . str_replace('-', '', $birthdate);
|
||||
|
||||
|
||||
// Überprüfen, ob der unique_key in der Datenbank existiert
|
||||
$stmt = $con->prepare("SELECT * FROM survey_patients WHERE unique_key = ?");
|
||||
$stmt->bind_param("s", $unique_key);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
// Wenn der Patient existiert
|
||||
if ($result->num_rows > 0) {
|
||||
$patient = $result->fetch_assoc();
|
||||
// Überprüfen, ob der Patient bereits im aktuellen Jahr an der Umfrage teilgenommen hat
|
||||
$last_taken = $patient['survey_last_taken'];
|
||||
if (strtotime($last_taken) >= strtotime("last year")) {
|
||||
echo "Sie haben bereits in diesem Jahr an der Umfrage teilgenommen.";
|
||||
exit;
|
||||
} else {
|
||||
// Authentifizierung erfolgreich, Fragen anzeigen
|
||||
$_SESSION['patient_id'] = $patient['id']; // ID speichern, um später auf die Antworten zuzugreifen
|
||||
header("Location: survey_form.php");
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
echo "Ungültige Eingaben. Bitte überprüfen Sie Ihre Daten.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
include_once("inc/functions.inc.php");
|
||||
include_once('inc/functions.impfen.inc.php');
|
||||
include_once('inc/functions.formulare.inc.php');
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
Alpha by HTML5 UP
|
||||
html5up.net | @n33co
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<?php
|
||||
|
||||
include('header.php');
|
||||
|
||||
?>
|
||||
<title>Praxis Creutzburg - Umfrage</title>
|
||||
<link rel="stylesheet" href="css/formulare.css" />
|
||||
</head>
|
||||
<body >
|
||||
|
||||
<!-- Header -->
|
||||
<header id="header" class="../skel-layers-fixed">
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
include('menu.php');
|
||||
|
||||
|
||||
?>
|
||||
</header>
|
||||
|
||||
|
||||
<!-- Main -->
|
||||
<section id="main" class="container">
|
||||
<?php
|
||||
echo showHeaderpraxis();
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<section class="box special">
|
||||
<h2>Patientenbefragung</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="12u">
|
||||
|
||||
|
||||
<!-- Form -->
|
||||
<section class="box">
|
||||
|
||||
<h2>Authentifizierung</h2>
|
||||
<p>Die Umfrage erfolgt anoym! <br>
|
||||
|
||||
Da nur Patienten der Praxis Creutzburg zur Teilnahme berechtigt sind, muss im Vorfeld eine Authentifizierung erfolgen.<br>
|
||||
Eine Zuordnung der Umfrage zu einem Patienten ist technisch ausgeschlossen.<br><br>
|
||||
|
||||
Das Praxis Team freut sich auf Ihr Feedback und Verbesserungsvorschläge, um das Serviceerlebnis für unsere Patienten und unser Personal zu verbessern.<br><br>
|
||||
Bitte geben Sie Ihre Daten ein, um an der Umfrage teilzunehmen.<br>
|
||||
Bei Vor- und Nachname reichen die ersten beiden Buchstaben.<br>
|
||||
</p>
|
||||
|
||||
|
||||
<?php echo '<form action="'. $_SERVER['PHP_SELF'] .'" method=POST>';
|
||||
echo '<input type="hidden" name="aktion" id="aktion" value="1" />';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row uniform 50%">
|
||||
|
||||
|
||||
<label for="first_name">Vorname:</label>
|
||||
<input type="text" id="first_name" name="first_name" required>
|
||||
|
||||
<label for="last_name">Nachname:</label>
|
||||
<input type="text" id="last_name" name="last_name" required>
|
||||
|
||||
<label for="birthdate">Geburtsdatum:</label>
|
||||
<input type="date" id="birthdate" name="birthdate" required>
|
||||
|
||||
<ul class="actions">
|
||||
<li><input type="submit" value="Anmelden" /></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
}
|
||||
include_once('footer.php');
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include_once("inc/config.inc.php");
|
||||
|
||||
|
||||
// Wenn das Formular abgesendet wird
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
$first_name = $_POST['first_name'];
|
||||
$last_name = $_POST['last_name'];
|
||||
$birthdate = $_POST['birthdate'];
|
||||
|
||||
// Erstelle den unique_key
|
||||
$unique_key = substr($first_name, 0, 2) . substr($last_name, 0, 2) . str_replace('-', '', $birthdate);
|
||||
|
||||
|
||||
// Überprüfen, ob der unique_key in der Datenbank existiert
|
||||
$stmt = $con->prepare("SELECT * FROM survey_patients WHERE unique_key = ?");
|
||||
$stmt->bind_param("s", $unique_key);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
// Wenn der Patient existiert
|
||||
if ($result->num_rows > 0) {
|
||||
$patient = $result->fetch_assoc();
|
||||
// Überprüfen, ob der Patient bereits im aktuellen Jahr an der Umfrage teilgenommen hat
|
||||
$last_taken = $patient['survey_last_taken'];
|
||||
if (strtotime($last_taken) >= strtotime("last year")) {
|
||||
echo "Sie haben bereits in diesem Jahr an der Umfrage teilgenommen.";
|
||||
exit;
|
||||
} else {
|
||||
// Authentifizierung erfolgreich, Fragen anzeigen
|
||||
$_SESSION['patient_id'] = $patient['id']; // ID speichern, um später auf die Antworten zuzugreifen
|
||||
header("Location: survey_form.php");
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
echo "Ungültige Eingaben. Bitte überprüfen Sie Ihre Daten.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
include_once("inc/functions.inc.php");
|
||||
include_once('inc/functions.impfen.inc.php');
|
||||
include_once('inc/functions.formulare.inc.php');
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
Alpha by HTML5 UP
|
||||
html5up.net | @n33co
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<?php
|
||||
|
||||
include('header.php');
|
||||
|
||||
?>
|
||||
<title>Praxis Creutzburg - Umfrage</title>
|
||||
<link rel="stylesheet" href="css/formulare.css" />
|
||||
</head>
|
||||
<body >
|
||||
|
||||
<!-- Header -->
|
||||
<header id="header" class="../skel-layers-fixed">
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
include('menu.php');
|
||||
|
||||
|
||||
?>
|
||||
</header>
|
||||
|
||||
|
||||
<!-- Main -->
|
||||
<section id="main" class="container">
|
||||
<?php
|
||||
echo showHeaderpraxis();
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<section class="box special">
|
||||
<h2>Patientenbefragung</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="12u">
|
||||
|
||||
|
||||
<!-- Form -->
|
||||
<section class="box">
|
||||
|
||||
<h2>Authentifizierung</h2>
|
||||
<p>Die Umfrage erfolgt anoym! <br>
|
||||
|
||||
Da nur Patienten der Praxis Creutzburg zur Teilnahme berechtigt sind, muss im Vorfeld eine Authentifizierung erfolgen.<br>
|
||||
Eine Zuordnung der Umfrage zu einem Patienten ist technisch ausgeschlossen.<br><br>
|
||||
|
||||
Das Praxis Team freut sich auf Ihr Feedback und Verbesserungsvorschläge, um das Serviceerlebnis für unsere Patienten und unser Personal zu verbessern.<br><br>
|
||||
Bitte geben Sie Ihre Daten ein, um an der Umfrage teilzunehmen.<br>
|
||||
Bei Vor- und Nachname reichen die ersten beiden Buchstaben.<br>
|
||||
</p>
|
||||
|
||||
|
||||
<?php echo '<form action="'. $_SERVER['PHP_SELF'] .'" method=POST>';
|
||||
echo '<input type="hidden" name="aktion" id="aktion" value="1" />';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row uniform 50%">
|
||||
|
||||
|
||||
<label for="first_name">Vorname:</label>
|
||||
<input type="text" id="first_name" name="first_name" required>
|
||||
|
||||
<label for="last_name">Nachname:</label>
|
||||
<input type="text" id="last_name" name="last_name" required>
|
||||
|
||||
<label for="birthdate">Geburtsdatum:</label>
|
||||
<input type="date" id="birthdate" name="birthdate" required>
|
||||
|
||||
<ul class="actions">
|
||||
<li><input type="submit" value="Anmelden" /></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
}
|
||||
include_once('footer.php');
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user