Welcome Guest, Not a member yet? Register   Sign In
More Help with Encryption....
#1

[eluser]drbigfresh[/eluser]
So i have moved a site to a new server for a client, everything is working, but no one can log-in using their old credentials. All the passwords stored in the database look like this:
d7mz4lTossSGKu7pCZ/3Bgrug/elNB/Hqyc6U5A2T/xmGIfUTWMeIwNw+0496hatZKVbdK5Vm/OHyvmaPiOmkQ==

If I go, and register fresh, it works no problem, and my password looks like this:
AT9SNQ5gAjUCbVdl

The passwords are being stored as such:
$this->encrypt->encode($this->input->post('password'));

The odd part is that is I call a decode on an old password it comes back with jibberish characters like:
�W�%�P���s���j�w/l ����x�;Hdf

but if I call decode on a newly registerered user, it decodes it fine.

The only thing that has changed, is the server. All the code is exactly the same. If anyone can provide any help let me know, I've exhausted myself trying to figure it out.

Thanks,
Scott.
#2

[eluser]Randy Casburn[/eluser]
did you run php_info() on both the old and new server and do a close comparison of both to find the differences?
#3

[eluser]Matthieu Fauveau[/eluser]
Are you sure you MySQL tables are set up correctly ? Do they have the correct collation ?
#4

[eluser]drbigfresh[/eluser]
Randy, you are a genius. Looks like the old site had mcrypt installed on it, and I think it was double-encrypting.
#5

[eluser]Randy Casburn[/eluser]
I wouldn't go that far...but I'm glad I could help.

Thanks for the kind words.

Randy
#6

[eluser]GF[/eluser]
I have the same problem but in reverse. My dev box does not have mcrypt and the live website I'm uploading to does, so my login routine (checking a form value against a decrypted database value) does not work correctly. In fact, the CI encryption class does not seem to work correctly at all ($this->encrypt->decode($some_string) appears to return null instead of a plain text decrypted value). Any suggestions on what I need to check on the live server? I've tried changing config items, double checked that my database tables are the same, etc., but to no avail. Any pointers in the right direction are appreciated.

[UPDATE]: I ended up just re-encrypting the values in the live database as there were only a few entries to manipulate, and that solved the issues. The CI encrypt class was of course returning null when $this->encrypt->decode($string) was called because the string in the database was too short. Anyway, it's all better now -- thanks for your helpful information that led to the correction.


Blessings,

Graham




Theme © iAndrew 2016 - Forum software by © MyBB