Warunek może być albo po ID=1 albo po loginie: admin. Bardzo proszę o pomoc, trochę się już z tym męczę
Kod
session_start();
require_once 'config.php';
$Message = "";
if (empty($_POST['login']) || empty($_POST['haslo']))
{
$Message = "Login lub hasło jest puste!";
header('location: index.php?Message='.$Message);
exit;
}
$wynik = mysql_query("select * from users where Login = '".$_POST['login']."'");
$ilosc_wynikow = mysql_num_rows($wynik);
if ($ilosc_wynikow == 0)
{
$Message = "Podany użytkownik nie istnieje!";
header('location: index.php?Message='.$Message);
}
else {
while ($row = mysql_fetch_assoc($wynik)) {
if ($row['Password'] == md5($_POST['haslo']))
{
$_SESSION['zalogowany'] = TRUE;
$_SESSION['login'] = $row['Login'];
$_SESSION['email'] = $row['Email'];
$Message = "Zostałeś zalogowany!";
header('location: index.php?Message='.$Message);
} else {
$Message = "Podane hasło jest błędne!";
header('location: index.php?Message='.$Message);
}
}
}
require_once 'config.php';
$Message = "";
if (empty($_POST['login']) || empty($_POST['haslo']))
{
$Message = "Login lub hasło jest puste!";
header('location: index.php?Message='.$Message);
exit;
}
$wynik = mysql_query("select * from users where Login = '".$_POST['login']."'");
$ilosc_wynikow = mysql_num_rows($wynik);
if ($ilosc_wynikow == 0)
{
$Message = "Podany użytkownik nie istnieje!";
header('location: index.php?Message='.$Message);
}
else {
while ($row = mysql_fetch_assoc($wynik)) {
if ($row['Password'] == md5($_POST['haslo']))
{
$_SESSION['zalogowany'] = TRUE;
$_SESSION['login'] = $row['Login'];
$_SESSION['email'] = $row['Email'];
$Message = "Zostałeś zalogowany!";
header('location: index.php?Message='.$Message);
} else {
$Message = "Podane hasło jest błędne!";
header('location: index.php?Message='.$Message);
}
}
}