title: Login & register user // PHP/MYSQL OOP
body: <p>It's going to drive me crazy ... 
  So, What am i doing wrong ? Where is my error ? </p>
  
  <p>When i try to connect, it always show me the result where user and password are wrong even they're right ... </p>
  
  <p>If someone has an idea to implement session also ? </p>
  
  <p>Thanks in advance for your help </p>
  
  <p>Peace &amp; Unity ! </p>
  
  <p>Here's the beast ! </p>
  
  <h2>INDEX.PHP</h2>
  
  <pre><code>&lt;?php 
  
  include_once('user.php');
  
  if(isset($_POST[submit])){
      $name = $_POST['login'];
      $pass = $_POST['password'];
  
  
      $object = new User() ;
      $object-&gt;Login($name, $pass); 
  
      }
  
  ?&gt;
  
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;form method="post" action="index.php"&gt;
      login : &lt;input type="text" name="login" /&gt;&lt;br&gt;
      password : &lt;input type="text" name="password" /&gt;
      &lt;input type="submit" name="submit"  value="login" /&gt;
  
      &lt;/form&gt;
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h1>dbConnect.php</h1>
  
  <pre><code>&lt;?php 
  
  class Connection {
  
      public function dbConnect(){
  
          return new PDO("mysql:host=localhost; dbname:test","root","");
  
          }
  
  
      }
  
  
  ?&gt;
  </code></pre>
  
  <h2>USER.PHP</h2>
  
  <pre><code>&lt;?php 
  
  include_once('dbConnect.php');
  
  Class User {
      //Start Construct
      Private $db;
  
      public function __construct () {
              $this-&gt;db = new Connection();
              $this-&gt;db = $this-&gt;db-&gt;dbConnect();
  
          } 
  // End Construct
  
  public function Login($name, $pass) {
  
      if(!empty($name) &amp;&amp; !empty($pass)){
          $st = $this-&gt;db-&gt;prepare("SELECT * FROM user Where user_login=? AND user_pass=?");
          $st-&gt;bindParam(1, $name);
          $st-&gt;bindParam(2, $pass);
          $st-&gt;execute();
  
          if($st-&gt;rowCount() == 1){
              echo "User Connected";
              }else{
  
                  echo "Vachez ta mère";
                  }
  
  
          }else{
  
              echo "Enter a valid Login and Password";
              }
  
  
  
  
  
      }
  
  
  }
  ?&gt;
  </code></pre>