Originally posted by: BingBongWongFooey
Originally posted by: KahunaHube
Originally posted by: BingBongWongFooey
You should use $_COOKIE now, not HTTP_COOKIE_VARS.
The script above does no actual authentication, it just forwards you to another page. If you went to that page manually, it would work just the same. If you want to protect some pages, I would make a script that checks for a cookie, if it's not set, then send them to a login page. Include this script at the very beginning of any pages you want to protect. Learning how to use a database is not a super-quick thing, and neither is php (I don't know how much php you know). You should take some care to actually *learn* both before using them for anything remotely important. I wouldn't really trust other peoples' scripts and stuff that you find on hotscripts.com, etc either.
BTW, this stuff *isn't* all that simple, no matter what. webpages + security = PITA
They do right now, but the HTTP_*_VARS are going to go away eventually, $_COOKIE, $_GET, $_POST, $_SERVER, $_ENV, etc etc are what you should use.
http://www.php.net/variables.predefined
BTW, if you aren't able to keep up with all of the changes in php, you should probably use something else, like perl, python, or asp, something that won't change quite so quickly. PHP is still pretty immature and changes often, sometimes for security reasons. If you aren't willing to keep up with it - and keep your code up to date - you are asking for trouble. Look at sites running old versions of php-nuke for an example