Deucalion 249 Posted January 17, 2015 Share Posted January 17, 2015 Hi I'm using pdo so my code look like this: $CreateAcount = $sth->prepare( "INSERT INTO account.account (login, password, email, social_id, question1, answer1, web_ip, register_token) VALUES (:login, :password, :email, :socialId, :question, :answer, :webIp, :registerToken)" ); $CreateAcount->execute(array(":login" => $login, ":password" => $password ,":email" => $email,":socialId" => $socialId,":question" => $question,":answer" => $answer,":webIp" => GetIP() ,"registerToken" => GetIP())); and here my question: How can I encrypt password ? Now when I write in field password e.g testpassword, in mysql password isn't encryptet, it's just "testpassword" Can u help me? Regards Deucalion Link to comment Share on other sites More sharing options...
Former Staff .InyaProduction 1124 Posted January 17, 2015 Former Staff Share Posted January 17, 2015 ...VALUES (:login, PASSWORD(':password')... This should work 1 Link to comment Share on other sites More sharing options...
Deucalion 249 Posted January 17, 2015 Author Share Posted January 17, 2015 Okey, but what is this function PASSWORD? Link to comment Share on other sites More sharing options...
Solution SoNiice 14 Posted January 17, 2015 Solution Share Posted January 17, 2015 The PASSWORD function ist from MySQL itself, but you also can do it in PHP directly like this: <?php $sPasswordHash = '*' . strtoupper(sha1(sha1($sPassword, true))) This function will hash your password string to exactly that the same like MySQL5 PASSWORD function output. 1 Link to comment Share on other sites More sharing options...
Deucalion 249 Posted January 17, 2015 Author Share Posted January 17, 2015 Okey, thanks a lot! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now