I'm developing a website that will be accessible from LAN only. I still wish to make it as safe as possible.
From web point of view, is it enough to add SESSION check to every PHP file, use prepared mysqli statements and use HTTPS?
I will be more specific:
I'm checking every PHP page with this:
if(!isset($_SESSION['login']) || $_SESSION['UA'] != $_SERVER['HTTP_USER_AGENT'] || $_SESSION['IP'] != $_SERVER['REMOTE_ADDR'] || time() - $_SESSION['timeout']>=600){
session_unset();
session_destroy();
header('Location:index.php');
I also regenerate session ID on every page, just to be sure. So I'm checking user's user agent, IP address, activity timeout and a session variable "login".
For mysql connection I mostly use prepared statements (mysqli) for security and performance, in cases I don't or can't use prepared statement, I always do real_escape_string() when dealing with client data.
I will also allow HTTPS only, with checking $_SERVER['HTTPS'] = "on"
.
The server is never setting any cookies, except PHPSSID.
Is this all I can do to make my website secure, or is there anything else? I found bits and pieces all over the web how to secure a website, but nothing on one place, so that's why I'm asking here.