title: Trying out login page in PHP
body: <p>I am trying out a login page in using I am using the below code to make it work. I am not sure why isn't it getting to sucess.php even after typing correct user and password.</p>
  
  <pre><code>&lt;?php
  
  include("db_config.php");
  session_start();
  
  if($_SERVER["REQUEST_METHOD"] == "POST")
  {
  
   $myusername=addslashes($_POST['username']); 
   $mypassword=addslashes($_POST['password']); 
  
   print_r($mypassword);
  
   $mypassword = hash('sha512', $mypassword);
  
   print_r($mypassword);
  
   $sql="SELECT * FROM user WHERE username='$myusername' and password='$mypassword'";
   $result = mysql_query($sql);
   $row = mysql_fetch_array($result);
   $auth = $row['auth'];
   $count = mysql_num_rows($result);
   print_r($count);
   $response = array();
  
   if($count==1)
   {
  
     print_r("Login Sucess");
     if($auth==1)
     {
       print_r("Login Sucess");
       $_SESSION['name'] =  $myusername;
       header("location: http://www.abcdef.com/sucess.php"); 
    }
    else
    {
      //Nothing for now... 
      print_r("Nothing for now");
    }
  }
  else 
  {
  
     print_r("Your Login Name or Password is invalid");
  
   }
  }
  ?&gt;
  </code></pre>
  
  <p>If I give a wrong password it prints invalid password and the related things that needs to print, but if type correct password it doesn't print anything and doesn't get the next page too.</p>
  
  <p>I am not sure where I am going wrong. Can somebody help me fix this?</p>
  
  <p>Thanks!</p>