Tuesday 15 January 2013

mysql - php login password not accepted -


I'm not able to log in using the code below. So, this is my code:

< Pre> public function author ($ login, $ password) {$ login = $ this- & gt; Db- & gt; Real_account_string ($ login); $ Tmp = $ this- & gt; Db- & gt; Query ("Select ID, password where user is login = '$ login' ') ;; if (! $ Tmp-> num_rows) {return false;} $ UserData = $ tmp-> fetch_assoc (); var_dump ($ Userdata); var_dump (SHA1 ($ password '|' $ login).); If ($ userData ['password'] == sha1 ($ password. '.' $ Login)) {$ userData {'id '];} Other {return false;}}}

and here is the output from var dump

  array (2) {["id"] = & Gt; String (1) "7" ["password"] =>       Div class = "post- Text "itemprop =" text "> 

Why do not you just ..

  $ this-> db-> query ('selection' id ',' password ' From 'sub 'Login' =? And `password` = SHA1 (CONCAT (?," | ",?)), Array ($ login, $ password, $ login));  
< / Div>

No comments:

Post a Comment