Hi board,
I'm stuck with the following task: I want to write a function which compares some user input to a value which is stored with the MySQL ENCRYPT() function in a database.
I read the MySQL documentation about the ENCRYPT() function and the documentation about the PHP crypt() function.
Both claim to use the crypt() UNIX system call, so I was happy, cause I thought I could do something like this:
if ($value_from_db == crypt($user_input)) user_is_valid();
But of course this doesn't work because I get different results when I use the ENCRYPT() function and the crypt() function on the same string. The UNIX manpage 'man 3 crypt' does not help me very much either, and as I'm really not an expert with this kind of stuff I am pretty stuck now.
The environment I am working on is a Debian 3.1 Sarge system with MySQL 5.0.24 and PHP 5.1.5.
I would very much appreciate it if anyone could point me into the right direction how to get the task done.
Thanks for reading.