title: login php not working
body: <p>I've this set of login codes. When I type the correct password, I'll be able to get into the webpage. But I'm not sure why, when I type the wrong password, I will still be able to get into the webpage.</p>
  
  <p>I am not sure where is the error. </p>
  
  <p>This is my php code:</p>
  
  <pre><code>&lt;?php
  
  //define page title
  $title = 'Sign In';
  
  session_start();
  include_once 'dbconnect.php';
  
  
  if(isset($_SESSION['user'])!="")
  {
   header("Location: home.php");
  }
  if(isset($_POST['btn-login']))
  {
  
    $UserEmail = isset($_GET['UserEmail']) ? $_GET['UserEmail'] : '';
  
    $Password = isset($_GET['Password']) ? $_GET['Password'] : '';
  
  
   $result=mysql_query("SELECT * FROM tbl_user WHERE UserEmail='$UserEmail'");
   $row=mysql_fetch_array($res);
   if($row['Password']=md5($Password))
   {
    $_SESSION['user'] = $row['Password'];
    header("Location: home.php");
   }
   else
   {
    ?&gt;
          &lt;script&gt;alert('wrong details');&lt;/script&gt;
       &lt;?php
       }
  
      }
      ?&gt;
  </code></pre>