title: php login - something wrong with the validation in fields
body: <p>I have a problem with my login form, because if I put some text in password field and empty in the user/email field it the form will execute and redirect to index page.</p>
  
  <p><strong>this the site</strong>
  <a href="http://www.itbotics.com/login.php" rel="nofollow">http://www.itbotics.com/login.php</a></p>
  
  <p>other validations is ok, I just want to make it safe.
  thanks</p>
  
  <p><strong>this is my code</strong></p>
  
  <pre><code>                    if ($user == $email &amp;&amp; $pass = $password) {
                          session_start();
                          $_SESSION['mysesi'] = $name;
                          $_SESSION['user'] = $user;
                          echo "&lt;script&gt;window.location.assign('index.php')&lt;/script&gt;";
                      } elseif (empty($email) || empty($password)) {
                          ?&gt;
                          &lt;div class="alert alert-danger alert-dismissible" role="alert"&gt;
                              &lt;button type="button" class="close" data-dismiss="alert"&gt;&lt;span aria-hidden="true"&gt;×&lt;/span&gt;&lt;span class="sr-only"&gt;Close&lt;/span&gt;&lt;/button&gt;
                              &lt;strong&gt;Warning!&lt;/strong&gt; Please fill out all fields.
                          &lt;/div&gt;
                          &lt;?php
                      } else {
                          ?&gt;
                          &lt;div class="alert alert-danger alert-dismissible" role="alert"&gt;
                              &lt;button type="button" class="close" data-dismiss="alert"&gt;&lt;span aria-hidden="true"&gt;×&lt;/span&gt;&lt;span class="sr-only"&gt;Close&lt;/span&gt;&lt;/button&gt;
                              &lt;strong&gt;Warning!&lt;/strong&gt; Incorrect combination of Email Address and Password.
                          &lt;/div&gt;
          &lt;?php
      }
  }
  </code></pre>