Well, i dont know exactly what this is supposed to do, but there is an issue...
if(!isset($_COOKIE['user']) || (isset($_COOKIE['user']) && md5($_SERVER['REMOTE_ADDR']+5)!=$_COOKIE['user'])){
header('Location: /login.php');
exit();
}
when you put
if(!isset(blah blah lbah) || isset(blah blah blah) ... you have created a tautology. This will always evaluate to true since you are using or operators. so if there is a variable set, it will be (TRUE or FASLE), and if there isnt a variable set it will be (FALSE or TRUE) both of these since you are using or will evaluate to true.
Once I have the user is logged in, it's supposed to check that the cookie is working on every page. I'm really new to PHP and so cookies still really confuse me.