Witam, mam funkcję odpowiedzialną za logowanie
public function login() {
include("language/pl.php");
if (!empty($_POST['spr'])) { $this->login = $_POST['login'];
$this->haslo = md5($_POST['haslo']); $this->pyt = $this->pdo->prepare("SELECT * FROM users WHERE login=? AND haslo=?");
$this->pyt->execute(array($this->login, $this->haslo)); if (!empty($this->pyt)) { $_SESSION['login']=$this->login;
$this->stmt=$lang[4];
} else {
$this->stmt=$lang[5];
}
}
return $this->stmt;
}
i wywolanie
<?php
$login = new Klasa;
?>
<form method="POST" action="">
<input type="text" name="login" value=""/>
<input type="password" name="haslo" value=""/>
<input type="submit" value="Zaloguj" name="spr"/>
</form>
i komunikaty:
$lang[4]="Zostałeś zalogowany!";
$lang[5]="Podałeś niepoprawny login lub hasło!";
jednak coś jest nie tak, bo co bym nie wpisał to i tak zawsze wypisze "Zostałeś zalogowany!" co może być nie tak?