Mam dziwny problem z md5 przy logowaniu. W ogóle mnie nie chce logować. Wcześniej przy strukturalnie pisanym panelu miałem to samo ale udało mi się to rozwiązać ale nie przypomnę sobie jak. Dziwne jest to że jak w ogóle usunę md5 z $_POST['pass'] i żeby nie było też kodowane w bazie tylko normalnie to mnie loguje bez problemu. O co tu chodzi ?
<?php
class user {
public $user;
private $pass;
public function checkuser() {
$pdo = new pdo ('mysql:host=localhost;dbname=trial','root','mentormiszcz1e');
$row= $pdo-> query ("SELECT user,password FROM heh");
while ($line= $row-> fetch()) {
$this-> user= $line['user'];
$this-> pass= $line['password'];
if ($this->user== $_POST['user'] && $this-> pass
== md5($_POST['pass'])) { $_SESSION['user']= TRUE;
header ("Location: protect.php"); }
else {
header ("Location: log.html"); }
} // end while
$row-> closeCursor();
} // end function
}
$user= new user;
$user-> checkuser();
?>
<?php
if (isset($_SESSION['user'])) { }
else {
header ("Location: log.html"); }
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<form action="class.php" method="post"> <input type="text" name="user" /> <input type="password" name="pass" /> <input type="submit" value="Sign in" />