I've got a class called Membership, in which i have a two methods. The first one's called validateUser, and the second one is called encryptPass. The problem is that even though i call the encryptPass method, it returns the original password. In other words; it doesn't seem like it's actually returning the data or it's not calling the method correctly?
I'm new to OOP so don't judge me for not knowing very much now.
This is how it looks were i call the method:
//validate password and hash it if valid
if(strlen($password) > 25 || strlen($password) < 4) {
$password = $this->encryptPass($password);
$errorArray[] = "Löenordet måste vara mellan 4-25 tecken långt.";
}
And this is how the actual encryptPass method looks like:
function encryptPass($password) {
$salt = substr($password, 2, 4);
$password = md5(md5($password));
$password = substr($password, 0, 20) . $salt . substr($password, 0, 20);
$password = md5($password);
return $password;
}
I threw together a custom encryption algorithm as you can see, maybe i screwed up there somehow?
Thanks in advance!