title: I'm struggling with adding php count to login attempts on my login?
body: <pre><code>// Admin Login Function
  function Admin_Login() {
      $results = array();
      $results['pageTitle'] = "Admin Login - Admin";
      $results['pageHeading'] = "Admin Login";
      $results['pageHeading_p'] = "Login must be provided in order to gain administrative access.";
      $results['foo'] = "foo";
      if (isset($_POST['Admin_Login'])) {
                   // User Has Posted The Login Form: Attempt To Log The User In
          if ($_POST['username'] == ADMIN_USERNAME &amp;&amp; $_POST['password'] == ADMIN_PASSWORD) {
                    // Admin Logged In - Create Session
              $_SESSION['username'] = ADMIN_USERNAME;
                    // UseT Bad Sessions &amp; Resume To Admin
              if (isset($_SESSION['suspect_user'])) { unset($_SESSION['suspect_user']);unset($_SESSION['login_count']);}header("Location: Admin.php");
              } elseif ($_POST['username'] != ADMIN_USERNAME &amp;&amp; $_POST['password'] != ADMIN_PASSWORD) {
                  // User Triggered Session Bad User
              $_SESSION['suspect_user'] = 'Suspect User Bad';
              $results['errorMessage'] = "Incorrect username &amp; password. Please attempt again using the correct username &amp; password.";
              require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");
              } elseif ($_POST['username'] != ADMIN_USERNAME || $_POST['password'] != ADMIN_PASSWORD) {
                  // User Triggered Session Possible User 
              $_SESSION['suspect_user'] = 'Suspect User Good';
              $results['errorMessage'] = "Incorrect username/password. Please attempt login again.";
              require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");
              } if ($_SESSION['login_count'] &gt;= 3 &amp;&amp; $_SESSION['suspect_user'] == 'Suspect User Bad') {
                 // Login failed Under Session Bad User - Block The User
              $HTAccess_file = fopen(ROOT."/.htaccess", "a+");
              $htaccess_log =PHP_EOL."&lt;Files Admin.php&gt;".PHP_EOL."Order Allow,Deny".PHP_EOL."Deny from ".$_SERVER['REMOTE_ADDR'].PHP_EOL."&lt;/Files&gt;".PHP_EOL;fwrite($HTAccess_file, $htaccess_log);fclose($HTAccess_file);
              } if ($_SESSION['login_count'] &gt;= 3 &amp;&amp; $_SESSION['suspect_user'] == 'Suspect User Good') {
                 // Login failed Under Possible User - Show Captcha
              $results['foo'] = "bar";
              require(ROOT.Admin_INCLUDES."/Forms/Captcha.php");
          } else { $_SESSION['login_count'] ++;}
          } else {   // User Not Logged In: Display Admin Login Form - Default Action On Start
      require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");
       }
      }
  </code></pre>
  
  <p>Please help with adding count. I can't seem to post this the way it's asking me to.</p>
  
  <p>My issue is here so I'm just editing the whole post &amp; question. So where this-</p>
  
  <pre><code>    if ($_SESSION['login_count'] &gt;= 3 &amp;&amp; $_SESSION['suspect_user'] == 'Suspect User Good') {
                 // Login failed Under Possible User - Show Captcha
              $results['foo'] = "bar";
              require(ROOT.Admin_INCLUDES."/Forms/Captcha.php");
     }
  </code></pre>
  
  <p>Nothing is happening. I think I'm getting caught in a loop. Any help on this will be amazing. Actually amazing in an understatement.</p>