Registrierung_Daten serverseitig überprüft

master
GhadaA98 2023-05-30 19:57:00 +02:00
parent 289a66a5f3
commit b0d5e7a461
5 changed files with 305 additions and 2296 deletions

View File

@ -101,6 +101,9 @@
</html>';
}else{
session_unset();
session_destroy();
echo '
<html>
<head>
@ -125,7 +128,7 @@
<a id="uberuns" href="uberuns.html">Über Uns</a>
<a id="buecher" href="buecher.html">Bücher</a>
<a id="meinebuecher" href="anmelden_meinebuecher.php">Meine Bücher</a>
<a id="abmelden" href="abmelden.html">Abmelden</a>
<a id="abmelden" href="abmelden.php">Abmelden</a>
<form action="">
<input class="suchleiste" type="search" placeholder="Suche..." >
<button type="submit" id="buttonID" class="searchButton"><i class="fa fa-search"></i> </button>
@ -197,6 +200,7 @@
</body>
</html>';
exit();
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,77 @@
<!DOCTYPE html>
<?php
session_start();
if(isset($_POST['Registrieren'])){
$vorname = $_POST["vorName"];
$nachname = $_POST['nachName'];
$strasse = $_POST['strasse'];
$hausnummer = $_POST['hausnummer'];
$plz = $_POST['postleitzahl'];
$ort = $_POST['ort'];
$emailrep = $_POST['emailRep'];
$email = $_POST['email'];
$passwort = $_POST['passwort'];
$passwortrep = $_POST['passwortRep'];
if(empty($vorname) || empty($nachname) || empty($strasse) ||
empty($hausnummer) || empty($plz) || empty($ort) ||
empty($emailrep) || empty($email) || empty($passwort) || empty($passwortrep))
{
header("Location: registrierung_wiederholen.html");
}elseif (!preg_match("/^[A-Za-zÄÖÜäöüß -]*$/", $vorname)
|| !preg_match("/.{2,}/", $vorname)
|| preg_match("/(?:([- ])\1{1,}|( -)|(- ))/", $vorname)
|| !preg_match("/^([A-ZÄÖÜa-zäöüß]{2,}[ -]?)+$/", $vorname)
|| !preg_match("/[a-zäöüß]$/", $vorname)
|| !preg_match("/^[A-ZÄÖÜ][a-zäöüß]+([- ][A-ZÄÖÜ][a-zäöüß]+)*$/", $vorname)
|| preg_match("/(\w)\1{2,}/", $vorname)) {
header("Location: registrierung_wiederholen.html");
}elseif (!preg_match("/^[A-Za-zÄÖÜäöüß -]*$/", $nachname)
|| !preg_match("/.{2,}/", $nachname)
|| preg_match("/([-])\1{1,}/", $nachname)
|| !preg_match("/^([A-ZÄÖÜa-zäöüß]{2,}[ -]?)+$/", $nachname)
|| !preg_match("/[a-zäöüß]$/", $nachname)
|| preg_match("/[A-ZÄÖÜ][a-zäöüß]+[ ]+[A-ZÄÖÜ][a-zäöüß]+/", $nachname)
|| !preg_match("/^(von( der)?|zu)[ ][A-ZÄÖÜ]|^[A-ZÄÖÜ]/", $nachname)
|| !preg_match("/(^(von( der)?|zu)[ ][A-ZÄÖÜ][a-zäöüß]+|^[A-ZÄÖÜ][a-zäöüß]+)([-][A-ZÄÖÜ][a-zäöüß]+)?$/", $nachname)
|| preg_match("/(\w)\1{2,}/", $nachname)) {
header("Location: registrierung_wiederholen.html");
}elseif ( !preg_match("/.{2,}/", $strasse)
|| !preg_match("/^[^0-9]*$|[0-9]$/", $strasse)
|| !preg_match("/^[A-Za-z0-9ÄÖÜäöüß' -]+$/", $strasse)
|| !preg_match("/^[A-ZÄÖÜ][ -]?[a-zäöü0-9ß']+([ -]?[A-ZÄÖÜ0-9][A-Za-z0-9ÄÖÜäöüß']+)*$/", $strasse)
|| !preg_match("/[0-9]$|[a-zäöüß]$/", $strasse)) {
header("Location: registrierung_wiederholen.html");
}elseif ( !preg_match("/^[0-9]/", $hausnummer)
|| preg_match("/^0/", $hausnummer)
|| !preg_match("/^[1-9][0-9]{0,3}[a-z]?$/", $hausnummer)){
header("Location: registrierung_wiederholen.html");
}elseif ( !preg_match("/^(0100[1-9]|010[1-9][0-9]|01[1-9][0-9]{2}|0[2-9][0-9]{3}|[1-9][0-9]{4})$/", $plz)){
header("Location: registrierung_wiederholen.html");
}elseif ( !preg_match("/.{2,}/", $ort)
|| preg_match("/[ \/-][ \/-]/", $ort)
|| !preg_match("/^[A-ZÄÖÜa-zäöüß \/-]+$/", $ort)
|| preg_match("/(\w)\1{2,}/", $ort)
|| !preg_match("/^[A-ZÄÖÜ]/", $ort)
|| !preg_match("/[a-zäöüß]$/", $ort)
|| !preg_match("/^[A-ZÄÖÜ][a-zäöüß]+([ -\/][A-ZÄÖÜa-zäöü][a-zäöüß]+)*$/", $ort)){
header("Location: registrierung_wiederholen.html");
}elseif ( !preg_match("/[A-Za-z0-9_!#$%&'*+-\/=?^_`.{|}~]+[@][A-Za-z0-9-]+[.][A-Za-z]{2,}/", $email)){
header("Location: registrierung_wiederholen.html");
}elseif($email != $emailrep){
header("Location: registrierung_wiederholen.html");
}elseif (!preg_match("/^(?=.*[A-ZÄÖÜ])(?=.*[a-zäöüß])(?=.*[0-9])(?=.*[!°`´@#$%^&*()_+\-=\[\]{};':\"\\|,.<>\/?]).{6,}$/", $passwort)
|| !preg_match("/.{6,}/", $passwort)){
header("Location: registrierung_wiederholen.html");
}elseif($passwort != $passwortrep){
header("Location: registrierung_wiederholen.html");
}else{
echo '<!DOCTYPE html>
<html>
<head>
<meta lang="de"/>
@ -69,7 +142,7 @@
<script>
function linkToLoginPage() {
window.location.replace("anmelden_meinebuecher.html");
window.location.replace("anmelden_meinebuecher.php");
}
</script>
@ -81,7 +154,6 @@
<!--Link JS file-->
<script src="burgerIcon.js"></script>
<!--If it was small and got big, it calls the function only one time and doesn't do it all the time-->
<script>
var widthissue = false;
window.addEventListener("resize", function(event) {
@ -117,4 +189,9 @@
</body>
</html>
</html>';
}
}
?>

View File

@ -632,7 +632,7 @@ function checkRepeat_Password() {
* Ist dies der Fall, werden die Daten verarbeitet
* und der Nutzer wird auf die Seite "Erfolgreich registriert" weitergeleitet.
*/
function checkForPossibleSubmit() {
/*function checkForPossibleSubmit() {
var firstName = checkFirstName();
var lastName = checkLastName();
var streetName = checkStreetName();
@ -654,4 +654,4 @@ function checkForPossibleSubmit() {
// TODO: Soll irgendetwas passieren?
return false;
}
}
}*/

View File

@ -0,0 +1,98 @@
<!DOCTYPE html>
<html>
<head>
<meta lang="de"/>
<meta charset="utf-8"/>
<meta name="viewport" content="device=device-width, initial-scaling=1"/>
<link rel="Stylesheet" type="text/css" href="style.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>Candle Bibliothek | Erfolgreich Registriert</title>
<link rel="icon" href="pictures/candle.png">
</head>
<body>
<header>
<h1 class="kopf" >
<br><br>
Bibliothek <a href="index.html" id="bildID"> <img id="CandleID" src="pictures/candle.png" alt="Bild von einer Kerze"
width="200" height="192"/> </a>
<br><br> Candle
</h1>
<div>
<a id="uberuns" href="uberuns.html">Über Uns</a>
<a id="buecher" href="buecher.html">Bücher</a>
<a id="meinebuecher" href="anmelden_meinebuecher.php">Meine Bücher</a>
<a id="abmelden" href="abmelden.php">Abmelden</a>
<form action="">
<input class="suchleiste" type="search" placeholder="Suche..." >
<button type="submit" id="buttonID" class="searchButton"><i class="fa fa-search"></i> </button>
</form>
<a id="erweitertesuche" href="erweitertesuche.html">Erweiterte Suche</a>
<a href="anmelden.php" id="warenKorbID"> <img id="shoppingCard" src="pictures/einkaufswagen.png" alt="Bild von einem Wagen"
width="50" height="50"/> </a>
</div>
</header>
<!--------------------------------------------------------------------->
<div class="mainContentContainer">
<div class="titleContainer">
<h1 id="registeredTitle">Fehler</h1>
</div>
<div class="mainContent">
<p id="textFirstHalf">
Füllen Sie bitte alle Felder aus.
</p>
<input type="button" id="loginNowButton" value="Erneut Versuchen"
onclick="linkToRegisterPage()">
<script>
function linkToRegisterPage() {
window.location.replace("registrierung.php");
}
</script>
<br><br><br>
</div>
</div>
<!--------------------------------------------------------------------->
<!--Link JS file-->
<script src="burgerIcon.js"></script>
<script>
var widthissue = false;
window.addEventListener("resize", function(event) {
if(window.innerWidth > 800 && widthissue) {
widthissue = false
unset()
}
else if(window.innerWidth < 800) widthissue = true;
})
</script>
<nav id="activeid" class="active">
<div class="navLinks">
<input class="nav-toggleclass"id="nav-toggle" type="checkbox" onclick="openNav()";>
<label for="nav-toggle" class="icon-burger" >
<div class="line"></div>
<div class="line"></div>
<div class="line"></div>
</label>
</div>
</nav>
<footer class="fuss" >
<div>
<a id="impressum" href="impressum.html">Impressum</a>
<a id="kontakt" href="kontakt.html">Kontakt</a>
<a id="datenschutz" href="datenschutz.html">Datenschutz</a>
</div>
</footer>
</body>
</html>