git.schokokeks.org
Repositories
Help
Report an Issue
bibweb.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
7e9c083
Branches
Tags
master
bibweb.git
address.php
E-Mail-Adress-Feld als email markieren um @-Zeichen auf der Tastatur zu haben
Bernd Wurst
commited
7e9c083
at 2023-10-03 18:14:11
address.php
Blame
History
Raw
<?php require_once "lib/api.php"; require_once "lib/auftrag.php"; session_start(); if (!isset($_SESSION['phone']) || (!isset($_SESSION['name']) && !isset($_SESSION['firma']) && !isset($_SESSION['lname']))) { header('Location: index.php?error&num='.urlencode($_SESSION['phone']).'&name='.urlencode($_SESSION['name'])); die(); } $content = ''; $_SESSION['lname'] = ucwords($_SESSION['name']); $_SESSION['fname'] = ''; if (strpos($_SESSION['name'], ' ') !== false) { $parts = explode(" ", ucwords($_SESSION['name'])); $_SESSION['lname'] = array_pop($parts); $_SESSION['fname'] = implode(" ", $parts); } if (isset($_SESSION['name']) && !isset($_SESSION['kundennr'])) { $kunde = suche_kunde($_SESSION['name'], $_SESSION['phone']); if ($kunde) { $_SESSION['kundennr'] = $kunde['id']; } } if (isset($_REQUEST['error'])) { $content .= '<div class="card text-white bg-danger mb-3"> <div class="card-header">Fehler</div> <div class="card-body">Bitte geben Sie Ihren Namen an.</div> </div>'; } $headline = 'Adresse eingeben'; if (isset($_SESSION['kundennr']) && $_SESSION['kundennr']) { $headline = 'Willkommen zurück!'; $content .= ' <p>Schön, wir kennen uns ja schon! Aus Datenschutzgründen wird Ihre Adresse hier nicht angezeigt. Sofern Sie Änderungen an Ihren Kundendaten wünschen, sprechen Sie uns bitte vor Ort darauf an.</p>'; $content .= ' <form class="form" action="save.php" method="post"> <input type="hidden" name="form" value="address">'; if (!kunde_hat_email($_SESSION['kundennr'])) { $content .= '<p><strong>Dürfen wir Sie per E-Mail benachrichtigen?</strong><br>Wir kennen bisher noch keine E-Mail-Adresse von Ihnen. Wenn Sie uns eine E-Mail-Adresse angeben, können wir Sie auch per E-Mail über die Fertigstellung Ihres Auftrags benachrichtigen.</p> <div class="form-group form-group-lg row"> <div class="col-sm-12"><input class="form-control" id="email" name="email" type="email" placeholder="E-Mail-Adresse" autocomplete="email"></div> </div>'; } $content .= '<input name="fname" type="hidden" value="'.(isset($_SESSION['fname']) ? $_SESSION['fname'] : '').'"> <input name="lname" type="hidden" value="'.$_SESSION['lname'].'"> <div class="form-group form-group-lg"> <div><input class="btn btn-primary btn-lg" type="submit" value="Weiter >"></div> </div> </form> '; } else { $content .= ' <p>Bitte geben Sie in diesem Schritt Ihre Adresse ein.</p> '; $fields = array("vorname" => "Vorname", "nachname" => "Nachname", "firma" => "Firmenname", "email" => "E-Mail", "adresse" => "Adresse", "plz" => "PLZ", "ort" => "Ort"); $placeholders = $fields; $contents = $kunde; foreach ($fields as $field => $label) { if (isset($kunde[$field]) && $kunde[$field] == 'bekannt') { $placeholders[$field] = $label.' wie beim letzten Besuch'; $contents[$field] = ''; } elseif (!isset($contents[$field])) { $contents[$field] = ''; } } $content .= ' <form class="form" action="save.php" method="post"> <input type="hidden" name="form" value="address">'; /*if (isset($kunde['firma']) && $kunde['firma'] != '') { $content .= ' <div class="form-group form-group-lg row"> <div class="col-sm-12"><input class="form-control" id="address" name="address" type="text" placeholder="'.$placeholders['firma'].'" autocomplete="street-address" value="'.$contents['firma'].'"></div> </div>'; }*/ $content .= ' <div class="form-group form-group-lg row"> <div class="col-sm-6"><input class="form-control" id="fname" name="fname" type="text" placeholder="'.$placeholders['vorname'].'" autocomplete="given-name" value="'.$_SESSION['fname'].'"></div> <div class="col-sm-6"><input class="form-control" id="lname" name="lname" type="text" placeholder="'.$placeholders['nachname'].'" autocomplete="family-name" value="'.$_SESSION['lname'].'"></div> </div> <div class="form-group form-group-lg row"> <div class="col-sm-12"><input class="form-control" id="address" name="address" type="text" placeholder="'.$placeholders['adresse'].'" autocomplete="street-address" value="'.$contents['adresse'].'"></div> </div> <div class="form-group form-group-lg row"> <div class="col-sm-4"><input class="form-control" id="zip" name="zip" type="text" placeholder="'.$placeholders['plz'].'" autocomplete="postal-code" value="'.$contents['plz'].'"></div> <div class="col-sm-8"><input class="form-control" id="city" name="city" type="text" placeholder="'.$placeholders['ort'].'" autocomplete="locality" value="'.$contents['ort'].'"></div> </div> <div class="form-group form-group-lg row"> <div class="col-sm-12"><input class="form-control" id="email" name="email" type="email" placeholder="'.$placeholders['email'].'" autocomplete="email" value="'.$contents['email'].'"></div> </div> <div class="form-group form-group-lg"> <div><input class="btn btn-primary btn-lg" type="submit" value="Weiter >"></div> </div> </form> '; } include("template.php");