I was wondering if anyone is willing to look through my code and see if they can find any problems. Thanks!
You can download the files here: [Link removed temporarily. Please read post by Admin.]
The zip file contains my code, example database files, php config file, and lighttpd config file.
Info on the server
Router:
Virtual server port 443 tcp only
OS:
Windows 7 Ultimate x86
Auto updates enabled
Server:
lightTPD WLMP 1.4.26-1 (SSL)
Self signed SSL cert
Only listening on port 443
PHP:
5.3.3 VC9 x86 Non Thread Safe
Fastcgi listening on 127.0.0.1:521
WinCache 1.1
sqlite3 PDO
Every time a page loads:
Check to see if the IP has been banned
- Load an array of banned IPs from a RAM cache
- Check for IP, if the user is banned die()
- Increment a counter on every page request
- If a single IP has more than 10000 requests in 1 hr add their IP to the ban list
- Check session vars for auth=true
- Read username and key from cookie
- Compare key to sha256("static salt"+"hashed password"+"ip"+"username")
- If key matches set auth=true
- Compare hashedpass to sha256("random salt"+"password"+"username"+"admin rights"+"static salt");
- if key matches set auth=true
- Make sure there account has been initialized
- Make sure there account does not have a pending password reset
- Make sure there is no ban date attached to their account
- Make sure failed login attempts is less than 6
- If there was a failed login attempt increment the counter for that username
- Don't display any failure messages




