I want to extract my user data from a csv file, pack it into an array and then check whether the user’s input matches data from the csv file
This is my previous code:
<?php
session_start();
$handle = fopen('users.csv', 'r');
while (($csv_array = fgetcsv($handle, NULL)) !== false) {
foreach ($csv_array as $index) {
}
if (isset($_POST['vorname']) && isset($_POST['nachname']) && isset($_POST['mail']) && isset($_POST['passwort'])) {
$vorname = $_POST['vorname'];
$nachname = $_POST['nachname'];
$mail = $_POST['mail'];
$pw = $_POST['passwort'];
if ($vorname == $index['vorname'] && $nachname == $index['nachname'] && $mail == $index['mail'] && $pw == $index['passwort']) {
$_SESSION['vorname'] = $vorname;
$_SESSION['nachname'] = $nachname;
$_SESSION['mail'] = $mail;
$_SESSION['passwort'] = $pw;
header("Location: account.php");
}
}
}
fclose($handle);
?>
ps: i dont use a database for this