You are here: Re: md5 problem « PHP Language « IT news, forums, messages
Re: md5 problem

Posted by Harris Kosmidhs on 12/13/06 11:26

Ric wrote:
> Harris Kosmidhs schrieb:
>> Hello,
>> I have installed a tracker php program called Bytemoonsoon
>> (https://sourceforge.net/projects/bytemonsoon/). It' quite old but I
>> started messing with it.
>>
>> When a user sign ups the a $secret is created which is stored in the db
>> row of the user. An email is sent which says to go to a
>> confirm.php/<users_id>/<md5($secret)>
>>
>> The confirm.php gets the md5 secret (from the URL) and checks it against
>> the md5(<secret form the user row>) which should be identicall since the
>> <secret> is the same. But it's not! the md5 is different.
>>
>> Both pages are in UTf8 and the database is utf8_general_ci. Before the
>> select statements I do a mysql_query("set names utf8").
>>
>> Why do md5's are different? can somebody please help? thanks
>
> Well if I look in my glass bowl I can't see why:-)
>
> But if you add some debugging information you should be able to find out
> your self.
>
> I would track the whole creation, sending and reading of the md5 to find
> out where the md5 gets corrupted.
>
> for example you add an:
>
> error_log($mymd5);
>
> to your code, then visually compare the md5 here with the md5 you send
> to the user, then compare with the one which is in db etc.


Of course I do that. I print out everything but that's the point, they
are different while the $secret is the same! My question is if this has
something to do with the db being utf8.
Just to mentioned the $secret is generated with:
function mksecret($len = 20) {
$ret = "";
for ($i = 0; $i < $len; $i++)
$ret .= chr(mt_rand(0, 255));
return $ret;
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация