title: Login Page in Php with SqlSrv
body: <p>I have a problem, I create a login page for DashBoard (with SqlSrv in database)
  When the password in the DB and the password typed by the user are the same I can not even connect to when. 
  This is my code : </p>
  
  <pre><code>&lt;?php    
  session_start();
  
      $serverName = "A106MVP19\SQLEXPRESS";   
      $uid = "sa";     
      $pwd = "root";    
      $databaseName = "FormaSport";   
  
      $connectionInfo = array( "UID"=&gt;$uid,                              
                           "PWD"=&gt;$pwd,                              
                           "Database"=&gt;$databaseName);   
  
      /* Connect using SQL Server Authentication. */    
      $conn = sqlsrv_connect( $serverName, $connectionInfo);  
      if( $conn === false ) 
      {
       die( print_r( sqlsrv_errors(), true));
      }   
  
  
  if(isset($_POST) &amp;&amp; !empty($_POST['emailCo']) &amp;&amp; !empty($_POST['mot_de_passeCo'])) 
      {   
      $login = $_POST["emailCo"];
      $pass  = $_POST["mot_de_passeCo"];
      extract($_POST);
  
      $sql = "SELECT pass FROM Formateur WHERE mail='".$login."'";
      $req =  sqlsrv_query($conn, $sql) or die('Erreur SQL!&lt;br&gt;'.$sql.'&lt;br&gt;');
  
  
      $data = sqlsrv_fetch_array($req, SQLSRV_FETCH_ASSOC);
  
  echo $data['pass']."&lt;br /&gt;";    //for view the pass for the user in database
  echo $pass."&lt;br /&gt;";   //for view the input pass
  echo gettype($data['pass'])."&lt;br /&gt;";   // type of pass in DB
  echo gettype($pass)."&lt;br /&gt;";  // type pass input
  
      if($pass !== $data['pass'])
          {
          echo '&lt;p&gt;Mauvais login / password. Merci de recommencer&lt;/p&gt;';
          include('index.html'); // On inclut le formulaire d'identification en dessous du message d'information
          exit;
          }
      else
          {
          $_SESSION['login'] = $login;
          echo 'Vous etes bien logué';
          // Mettre une redirection ici 
          // redirection here
          }    
      }   
      else {
      echo '&lt;p&gt;Vous avez oublié de remplir un champ.&lt;/p&gt;';
      include('index.html'); // On inclut le formulaire d'identification
      exit;
  }
  
  
  ?&gt;
  </code></pre>
  
  <p>How you can view here : </p>
  
  <pre><code>echo $data['pass']."&lt;br /&gt;";    //for view the pass for the user in database
  echo $pass."&lt;br /&gt;";   //for view the input pass
  echo gettype($data['pass'])."&lt;br /&gt;";   // type of pass in DB
  echo gettype($pass)."&lt;br /&gt;";  // type pass input
  </code></pre>
  
  <p>I have test the type of password and they are the same.</p>
  
  <p>If everyone view where I have make an error, I need your help !</p>
  
  <p>Thank a lot.
  Pokky.</p>
  
  <p>PS : (Sorry for the "frenglish")</p>