Hat alles super geklappt. Alle Fehlermeldungen weg!!! Danke… ABER jetzt habe ich auf der nächsten Seite gleich das nächste Problem: Ich bekomme folgende Fehlermeldung:
Parse error: syntax error, unexpected T_ECHO, expecting ‚,‘ or ‚;‘ in C:\xampp\htdocs\login_profi\pages\Login.php on line 76
Ich habe bei den echos geguckt, kann aber keinen Fehler finden…
Hier der Quellcode:
<?php if(!$_SESSION['uid']){
if (!$\_POST['submit']){
?\>
Username
Passwort:
<?php }else{
$username = $\_POST['username'];
$password =md5($\_POST['password']);
$errors = array();
if ( !$username) {
$errors[1] = "You did not supply a username!";
}
if (!$password){
$errors[2] = "You did not supply a password!";
}
$sql = "SELECT \* FROM `users` WHERE `name` ='$username'";
$res = mysql\_query ($sql) or die (mysql\_error());
$exists = mysql\_num\_rows($res);
if ( $exists == 0){
$error[3] = "The username does not exist";
}else{
$sql = "SELECT \* FROM `users` WHERE `name` ='$username' AND `password`='$password'";
$res = mysql\_query ($sql) or die (mysql\_error());
$exists = mysql\_num\_rows($res);
if ( $exists == 0){
$error[4] = "The username and password dod not match";
}
}
if ( count ($errors) \>0 ) {
echo "
";
foreach ($errors as $error){
echo "
";
echo $error;
echo "
";
}
echo "
";
} else{
$sql = "SELECT \* FROM `users` WHERE `name` ='$username' AND `password`='$password'";
$res = mysql\_query ($sql) or die (mysql\_error());
$res = mysql\_fetch\_assoc($res);
$\_SESSION['uid'] = $res ['user\_id'];
echo "YOU have succesfully locked in!!!";
}
}
}else{
echo "You are already logged in!";
include ("pages/home.php");
}
?\>
Danke