Make PHP generated web content available only to you! I derived this function from some PHP code that I used on the administrative portion of my database driven sites. isLogged() returns true if the cookies named UserName and PassWord are not null, and successfully create a database connection when passed with the mysql_connect function. If not, it displays the content of $LogInPage.
This is a modified version of login.php. By doing this, I got rid of some redundancy in my code, and made it more portable. I would have used this to replace login.php, but I would have been neglecting the cases where sites don't have access to a MySQL database.