0
다음 코드는 "이 사실을 이해하지 못합니다"라는 결과를 생성합니다. 어떤 아이디어? 두 문자열의 길이가 같고 첫 번째 문자가 일치하고 실제로 시각적으로 같으면 왜 등호 연산자와 동일하지 않습니까 ??PHP 문자열이 같지 않지만 strpos와 길이가 같음
$userid = (int) $_POST['username'];
$password = trim($this->input->post('password'));
$hashed = trim(md5($password . $this->salt));
$success = false;
if($this->users[$userid]->password == $password) {
$success = true;
}
else {
if(strpos($hashed, $this->users[$userid]->password) === 0 &&
strlen($hashed) == strlen($this->users[$userid]->password)) {
echo "I don't understand this";
}
}
대답에 해쉬 패스워드로 md5를 사용하는 것이 좋습니다.
난 당신이 해시로 암호를 저장하고 생각하고 PHP5.3.2에게
오 <삽입 조어 여기>! 어리석은 감시. 나는 이것을 한시간 쳐다 보았고 그것을 볼 수 없었다. 감사. – Djehuty