Jak taki warunek stworzyć, żeby metoda porównująca sól z hasłem chodziła i żeby logowało?
<?php class auth { public $username; private $password; public $message; public $salt; private $pdo; public function __construct() { $this-> pdo= new PDO ('mysql:host=localhost;dbname=trial', 'root', ''); } public function get() { $stmt= $this->pdo -> prepare ('SELECT name,password,salt FROM experiment WHERE name=:name '); $stmt-> bindValue (':name', $_POST['username'], PDO::PARAM_STR); $stmt-> execute(); while ($row= $stmt-> fetch()) { $this-> username= $row['name']; $this-> password= $row['password']; $this-> salt= $row['salt']; } $stmt-> closeCursor(); } public function login($login) { { if ($this-> username== $login && $this->compare($this->password, $_POST['password'], $this->salt)) { $_SESSION['user']= $this-> username; $this-> message= 'Welcome ' . $_SESSION['user'] . ' <a href="users.php?signout=yes">sign out</a>'; } else { $this-> message= 'Invalid username or password'; } } else { $this-> message= 'Fill in all fields'; } } public function signout() { if ($_GET['signout']== "yes") { } } public function register($name, $password, $email, $salt) { { $stmt= $this->pdo -> prepare ('INSERT INTO experiment (name,password,email,salt) VALUES (:name,:password,:email,:salt) '); $stmt-> bindValue (':salt', $salt ,PDO::PARAM_STR); $stmt-> execute(); $stmt-> closeCursor(); } else { $this-> message= 'Fill in all fields'; } } public function show() { return $this-> message; } // solenie hasła <a href=\"http://athlan.pl/code/PassSalt\" target=\"_blank\">http://athlan.pl/code/PassSalt</a> public function salt($sPass) { } public function encode($sPass, $sSalt) { } public function compare($sPassCompare, $sPass, $sSalt) { return ($sPassCompare == $this-> encode($sPass, $sSalt)); } } ?>