Re: Login
| From: | Bernhard Kohl | Date: | Wed, 08 Oct 2008 18:52:35 +0000 |
| Subject: | Re: Login | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281596@lists.php.net to get a copy of this message | ||
<?php
# I would recommend using the include method. Redirects should always
be second choice, because they are just evil.
# Example code below
$password = md5('swordfish');
$user = 'Trucker Joe';
if ($_POST['user'] == $user && md5($_POST['password']) == $password) {
include_once('login_successful.php');
} else {
include_once('login_failed.php');
}
# Some may also hash the user to prevent injection
# http://us.php.net/manual/en/function.include.php
# http://en.wikipedia.org/wiki/Code_injection#PHP_Injection
?>