Thursday, 15 March 2012

Getting the value of a variable inside a while statement - PHP -


I can not find the value of a variable inside a loop here my code is:

  Function Check Login ($ username, $ password) {global $ dbh; Global $ queryPassword; $ Query2 = $ dbh- & gt; Query ("Choose WHERE user name from employee = '$ user name' and 'password` =' $ password ';"); $ Query2 - & gt; Settep Mod (PDO :: FETCH_ASSOC); While ($ line = $ query2-> fetch ()) {$ queryUsername = $ line ['username']; $ QueryPassword = $ line ['password']; } If (password_verify ($ password, $ queryPassword)) {echo ' 

no There may be problems in keeping it up

  $ stmt = $ dbh-> Ready (such as private, or preserved)  

and its more like it Also change to protect. "Choose from employee employee accounts WHERE User Name =: User and `Pasward` = pass; $); $ Stmt-> Execution (array (': user' = & gt; $ user name, '' pass' = & gt; $ password)); $ Query2 -> Settate mode (PDF :: FETCH_ASSOC);

Thus user input is escaped.


No comments:

Post a Comment