# New to coding and need some help

**URL:** <https://www.phphelp.com/t/new-to-coding-and-need-some-help/34556>\
**Category:** Uncategorized\
**Created:** [March 5, 2022, 4:19pm UTC](https://www.phphelp.com/t/new-to-coding-and-need-some-help/34556 "2022-03-05T16:19:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bubulooski](https://www.phphelp.com/letter_avatar_proxy/v4/letter/b/439d5e/32.png) [@bubulooski](https://www.phphelp.com/u/bubulooski)\
**Post date:** [March 5, 2022, 4:19pm UTC](https://www.phphelp.com/t/new-to-coding-and-need-some-help/34556/1 "2022-03-05T16:19:41Z")

</div>

I am trying to add a lock out for log after x times of login.

```
/* Check Username and Password existence in defined array */
if (isset($logins[$Username]) && $logins[$Username] == $Password){
    /* Success: Set session variables and redirect to Protected page */
    $_SESSION['UserData']['Username']=$logins[$Username];
    header("location:index.php");
    
    if ($logins != [$Username]
} else {
    /*Unsuccessful attempt: Set error message */
    $msg="<span style='color:red'>Invalid Login Details</span>";
}

```

}

Any help would be truly appreciated.

---

<div class="post-metadata">

**Author:** ![Strider64](https://www.phphelp.com/user_avatar/www.phphelp.com/strider64/32/3161_2.png) [@Strider64](https://www.phphelp.com/u/Strider64)\
**Post date:** [March 6, 2022, 6:38pm UTC](https://www.phphelp.com/t/new-to-coding-and-need-some-help/34556/2 "2022-03-06T18:38:22Z")

</div>

My personal opinion that feature is a pain in the neck for users and unless you are a bank or a financial all you are going to do is alienate people. Besides, I learn the hard way that unless you are a security expert that 99 percent of the hackers can easily bypass that feature.

---

<div class="post-metadata">

**Author:** ![whispers](https://www.phphelp.com/letter_avatar_proxy/v4/letter/w/858c86/32.png) [@whispers](https://www.phphelp.com/u/whispers)\
**Post date:** [March 7, 2022, 3:42pm UTC](https://www.phphelp.com/t/new-to-coding-and-need-some-help/34556/3 "2022-03-07T15:42:30Z")

</div>

More info would be needed.

Lock out for…? How long? Time? Forever?

What are you using as the ‘tracker’ for these users/attempts? an IP address? (can be spoofed)  
Sessions? (date be deleted/exploited)

You need to think this through in all scenarios.
