I am trying to integrate a simple login for my site with php. i found a script here http://www.phpfreecode.com/php-Login-system.htm got everything set up but this php code is cause the page not to load at all
<?php
if (isset($_COOKIE['user'])) {
echo "You are logged in: $_COOKIE['user'] Enjoy.";
} else{
echo "You are not logged in. <a href='register.php'>Register here</a>";
?>
I get a server error “The website encountered an error while retrieving (my website) It may be down for maintenance or configured incorrectly” i have php configured on my server, i know this because i have other php files that work on the website. what am i doing wrong? also if someone knows of a better login system im open for suggestions. Thank you.
The error with this piece of code you have suppled, is the $_COOKIE array not being seperated by curly brackets or broken out of the string.
or better yet:
Also that script is vulnerable to sql injection username:
whatever' OR 'X'='X& is using the soon tobe deprecated mysql_* functions.