title: How to login with both a name/email and a password/lastname
body: <p>I am trying to have my login page let users login using either their firstname/email or password/lastname.</p>
  
  <p>So far, it will only allow users to login using email/firstname in the first block &amp; in the second block only password, but not lastname.?</p>
  
  <p>here is what i have so far as php--></p>
  
  <pre><code>        &lt;?php
  ob_start();
  session_start();
  define("_APP_RUN", true);
  require '../AppINIT.php';
  $footerTxt = appconfig('footerTxt');
  $theme=  appconfig('theme');
  
  if (isset($_POST['login']))
  {
  $username=_post('username');
  $password=_post('password');
  $login_type=_post('login_type');
  
  if($username==''){
      conf('login.php','e','Please Enter Your Username');
  }
  
  if($password==''){
      conf('login.php','e','Please Enter Your Password');
  }
  
     $password = md5($secret . $password);
  
      $lastlogin=date("Y-m-d H:i:s");
  
  
  
  
  
  //added name,lname on 4-30-2016--to be able to login with name
      $stmt = $dbh-&gt;prepare("SELECT `id`, `email`, `name`, `lname`, `password`
                          FROM `accounts`
                          WHERE 
                              (
                                  `email` = :email AND `password` = :password
                              )
                          OR
                              (
                                  `name` = :first_name AND `lname` = :last_name
                              )
                          AND `status` = 'Active'
                          ");
  
      $stmt-&gt;execute(array(':email'=&gt;$username; ':password'=&gt;$password; ':first_name'=&gt;$username; ':last_name'=&gt;$password));
  
  
  //$stmt-&gt;bindParam(':user_id', $username, PDO::PARAM_STR, 12);
      //$stmt-&gt;bindParam(':password', $password, PDO::PARAM_STR, 30);
      $stmt-&gt;execute();
      $result = $stmt-&gt;fetchAll();
      if ($stmt-&gt;rowCount() == "1") {
          foreach ($result as $value) {
              $cmd=$value['id'];
              $_SESSION['cid'] = $value['id'];
              $lid = md5(uniqid(rand(), TRUE));
              $_SESSION['lid'] = $lid;
              setcookie("_lid", "$lid", time() + 86400);
              $login=ORM::for_table('accounts')-&gt;find_one($cmd);
               $login-&gt;online='1';
               $login-&gt;lastlogin=$lastlogin;
               $login-&gt;save();
  
              conf('index.php');
  
          }
      } else {
          conf('login.php', 'e', 'For Security Reasons We Can Not Tell You What Was Entered Wrong!');
      }
  
  }
  require ("views/$theme/login.tpl.php");
  
  ?&gt;
  </code></pre>
  
  <p>and here is what i have in html for calling it---></p>
  
  <pre><code>    &lt;form action="login.php" method="post"&gt;
                                     &lt;fieldset&gt;
                                        &lt;label&gt;
                                           &lt;span class="block input-icon input-icon-right"&gt;
                                              &lt;input type="text" class="span12" placeholder="Email Or First Name" name="username"/&gt;
                                              &lt;i class="icon-envelope"&gt;&lt;/i&gt;
                                           &lt;/span&gt;
                                        &lt;/label&gt;
  
                                        &lt;label&gt;
                                           &lt;span class="block input-icon input-icon-right"&gt;
                                              &lt;input type="password" class="span12" placeholder="&lt;?php echo $Lan['Password']; ?&gt; Or Last Name" name="password" /&gt;
                                              &lt;i class="icon-lock"&gt;&lt;/i&gt;
                                           &lt;/span&gt;
                                        &lt;/label&gt;
  
                                        &lt;div class="space"&gt;&lt;/div&gt;
  
                                     &lt;div class="clearfix"&gt;
  </code></pre>
  
  <p>
     
        &nbsp;Read Me First!
    
  </p>
  
  <pre><code>                                  &lt;button  class="width-35 pull-right btn btn-small btn-primary" type="submit" name="login"&gt;
                                              &lt;i class="icon-key"&gt;&lt;/i&gt;
                                               &lt;?php echo $Lan['login']; ?&gt;
                                           &lt;/button&gt;
                                        &lt;/div&gt;
  </code></pre>