php - login displaying wrong username and password -


i got login form, verified users.php file, tough username , password on database, says password wrong. database working correctly , it's connected page.

login form:

     <?php   require_once('/funcoes/users.php'); if( !empty($_post)){       try{         $users = new oop_users();         $result = $users->login($_post['username'], $_post['password']);          if ( $result == 'ok'){          }         else{             echo "username/password erradas!!";          }     }     catch(exception $e){         echo "authentication error!";     } }        else{         session_start();     }   ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>login</title> </head>  <body><?php     if(!isset($_session['username'])){     ?>            <form name="formulario_login" action="#" method="post"/>           <table>          <tr>          <td> username </td><td><input name="username" type="text" <span style="font-size: 15px;" ></input></td></tr>          <tr>          <td> password </td><td><input name="password" type="password" <span style="font-size: 15px;"></input></td></tr></tr>           <td colspan="7"><input type="submit" value="login"></td></tr>          </table>          <?php      }     else{          echo 'welcome ' . $_session['username'] . "! <br>".'<a href="logout.php">logout</a>';         echo '<br><a href="editaruser.php">alterar perfil</a>';         echo '<br><a href="apagaruser.php">apagar conta</a>';     }      ?> </body> </html> 

and in users.php got function

users.php:

public function login($username, $password){       $result = $this->_mydb->performquery("select * `users` `username' = '$username' , 'password' = '$password'");       if ( $result->num_rows != 1 ){         return ('authentication error');     }     else{             session_start();             $_session['username'] = $username;             return('ok');       }  } 

even tough have username "ines" , password "ines123" on database, every time try login got error: "authentication error!"

can tell me doing wrong?


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -