I am a newb to PHP and need help. I have been experiencing a lot of problems with PHP login/logout on Apache2, I switched from IIS to Apache2 because the header (location: bug that wont work. But it seems i exchanged a set of problems for a whole different set of problems. The page I made is out of a teach yourself book and its a basic dynamic page where you can register, login, change password and view users. But the problem I am having with cookies is that when i try to logout or go to the logout page that prints something and deletes the cookie it shows me a completely blank screen. Here is the script for the logout link.

<?php if (isset($_COOKIE['user_id']) AND (substr($_SERVER['PHP_SELF'], -10) != 'logout.php')){
echo '<a href="logout.php">Logout</a>';
} else {
echo '<a href="login.php">Login</a>';

Please respond or preferrably email me with help, and I will send entire script, I will send the session script too because there are even more problems with that.