Czy mógłby ktoś to wytłumaczyć?
<?PHP
function checkPass($user, $pass)
{
$userNameLength = strlen($user);
$userPassLength = strlen($pass);
if($userNameLength < 3 || $userNameLength > 20 ||
$userPassLength < 6 || $userPassLength > 40){
return 2; }
$db_handle = pg_connect("dbname = Biblioteka user = natalka password = zaq12wsx host = bazy.eti.pg.gda.pl");
$query = "SELECT COUNT(*) FROM Users WHERE Nazwa='$user' AND Haslo='$pass'";
if(!$result = pg_query($db_handle, $query)){
pg_close();
return 1;
}
if(!$row = @pg_fetch_row($result)){
pg_close();
return 1;
}
else{
if($row[0] <> 1){
pg_close();
return 2; }
else{
pg_close();
return 0;
}
}
}
session_start();
if(isSet($_SESSION['zalogowany'])){
header("Location: main.php");
}
else if(!isSet($_POST["haslo"]) || !isSet($_POST["user"])){
$_SESSION['komunikat'] = "Wpisz nazwę i hasło użytkownika:";
include('index.php');
}
else{
$val = checkPass($_POST["user"], $_POST["haslo"]);
if($val == 0){
$_SESSION['zalogowany'] = $_POST["user"];
header("Location: main.php");
}
else if($val == 1){
$_SESSION['komunikat'] = "Błąd serwera. Zalogowanie nie było możliwe.";
include('index.php');
}
else if($val == 2){
$_SESSION['komunikat'] = "Nieprawidłowa nazwa lub hasło użytkownika.";
include('index.php');
}
else{
$_SESSION['komunikat'] = "Błąd serwera. Zalogowanie nie było możliwe.";
include('index.php');
}
}
?>
czy include tylko wkleja zadany plik
co oznacza ten znak <>
jaką dokładnie funkcje pełni header
$_SESSION[''] czy moge dowolny ciąg znaków wklejać tu i jakie ma to znaczenia
nie bardzo rozumiem pogrubioną częśc