CSRF tokens. You use mt_rand()
to generate the CSRF token. This is not secure and represents bad practice. You need to use a cryptographically strong PRNG (e.g., read from /dev/urandom
), to ensure that the attacker cannot predict this value. mt_rand()
is not cryptographically strong. See, e.g., Is a rand from glibc's rand secure for a login key?Is a rand from glibc's rand secure for a login key?,
What are the requirements for a random number generator to a be safe to use in cryptography?What are the requirements for a random number generator to a be safe to use in cryptography?,
Is a rand from /dev/urandom secure for a login key?Is a rand from /dev/urandom secure for a login key?.
Failed logins. You ban the user for one month after 10 failed login attempts. This is probably not such a great idea, because it makes it too easy for "griefers" to lock someone out of their account for a month. I suggest reading the following questions on this site: Why do sites implement locking after 3 failed password attempts?Why do sites implement locking after 3 failed password attempts?, Is denying login after incorrect attempts ineffective?Is denying login after incorrect attempts ineffective?, Appropriate strategy for preventing brute forcing of logins?Appropriate strategy for preventing brute forcing of logins?, How do I secure my login page?How do I secure my login page?, Why re-verify with CAPTCHA on failed form entry?Why re-verify with CAPTCHA on failed form entry?.