anmeldesystem wurde geändert

master
GhadaA98 2023-06-14 19:22:59 +02:00
parent 5ba709c313
commit 02619b31b2
3 changed files with 30 additions and 23 deletions

View File

@ -53,7 +53,7 @@
session_start();
if(isset($_SESSION['eingeloggt']) && $_SESSION['eingeloggt'] == 1 ){
require_once "meinebuecher.php";
require_once "anmeldesystem_meinebuecher.php";
}else{
echo '

View File

@ -0,0 +1,28 @@
<?php session_start();
$db_link = mysqli_connect('localhost', 'web_b-3', 'een7Ao6s', 'bibliothek_candle', '3306');
function runSQL($sql){
global $db_link;
$db_res = mysqli_query($db_link, $sql);
if(!$db_res){
header("Location: 404.html");
exit;
}
return $db_res;
}
if(isset($_POST['submit'])){
$kartenid = $_POST['karten-id'];
$passwort = $_POST['password'];
$existiert = runSQL("SELECT COUNT(*) FROM `benutzer` WHERE `KartenID` = '$kartenid' and `Passwort` = '$passwort'");
$row = mysqli_fetch_array($existiert);
$karteexistiert = runSQL("SELECT COUNT(*) FROM `benutzer` WHERE `KartenID` = '$kartenid'");
$zeile = mysqli_fetch_array($karteexistiert);
header("Location: meinebuecher.php");
}else{
header("Location: 404.html");
}
?>

View File

@ -51,26 +51,7 @@
</header>
<?php
session_start();
$db_link = mysqli_connect('localhost', 'web_b-3', 'een7Ao6s', 'bibliothek_candle', '3306');
function runSQL($sql){
global $db_link;
$db_res = mysqli_query($db_link, $sql);
if(!$db_res){
header("Location: 404.html");
exit;
}
return $db_res;
}
if(isset($_POST['submit'])){
$kartenid = $_POST['karten-id'];
$passwort = $_POST['password'];
$existiert = runSQL("SELECT COUNT(*) FROM `benutzer` WHERE `KartenID` = '$kartenid' and `Passwort` = '$passwort'");
$row = mysqli_fetch_array($existiert);
$karteexistiert = runSQL("SELECT COUNT(*) FROM `benutzer` WHERE `KartenID` = '$kartenid'");
$zeile = mysqli_fetch_array($karteexistiert);
if($row['COUNT(*)'] > 0){
@ -222,9 +203,7 @@ if(isset($_POST['submit'])){
}else{
header("Location: benutzer_existiert_nicht.php");
}
}else{
header("Location: 404.html");
}
?>