Witam napisałem dosyć niedawno system logowania z autoryzacja użytkowników dzisiaj mam problem gdyż znalazłem skrypt i dość różni się od mojego możecie mi powiedzieć co po kolei on robi ?
<?PHP
include "baza.php";
function checkPass($user, $pass){
$query = "SELECT COUNT(*) FROM user WHERE user='$user' ";
$query .= "AND haslo='$pass'";
return 1;
}
return 1;
}
else{
if($row[0] <> 1){
return 2;
}
else{
return 0;
}
}
}
if(isSet($_SESSION['asd'])){ header("Location: index.php"); }
else if(!isSet($_POST["pass"]) || !isSet($_POST["login"])){ $_SESSION['komunikat'] = "Wpisz login i hasło:";
include('index.php');
}
else{
$val = checkPass($nick, $haslo);
if($val == 0){
$_SESSION['asd'] = $nick;
unSet($_SESSION['komunikat']); header("Location: index.php"); }
else if($val == 1){
$_SESSION['komunikat'] = "Błąd serwera.";
include('index.php');
}
else if($val == 2){
$_SESSION['komunikat'] = "Nieprawidłowy login lub hasło.";
include('index.php');
}
else{
$_SESSION['komunikat'] = "Błąd!";
include('index.php');
}
}
?>