MYSQL Functions
Hi (sorry for my english)
I have used salt for my user passwords. So, I should use mysql MD5 function like this:
...WHERE MD5(concat('$_POST['password']',salt))=password
How can i do this ? I think I can use the query() function but probably this cause sql injection.
Can you help me ?
Why do not just use PHP native function to do this stuff? Like md5($_POST['password']', $salt)?
If you really want to build the query for yourself, you can use quote() to escapes special characters.
WHERE password=' . $database->quote("MD5(concat('$_POST['password']', salt)") . '
http://medoo.in/api/quote
Using
...WHERE MD5(concat('$_POST['password']',salt))=password
is very bad for performance, because every (I repeat: EVERY) column-entry has to be be handled with md5. So if you have 1 mio. entries in the table you have to call mysql-function 'md5' 1 mio. times. Better idea, also for security reasons: store encrypted password in database and do a
WHERE password=$_POST['password']
Before that you can add salt.
what about using sysdate(), or now(), or parse functions, like month(date_column), etc i think this is very important
Yep, I'm currently using medoo in a small twitter app related project and I'm liking it, but I'm also wondering about using MySQL methods like NOW() because they are pretty essential.