Here are some authentication method that we'll discuss
- Basic authentication
We hard code the username and password combination in the login script itself.
Suitable for simple application
- User & password stored in database
A very common method. We store all the user name and password information
in the database
- User authentication with image verification
This is a more advance method of user authentication. We can prevent any
automatic login by a robot ( script ) by using this method
All three of these methods will use the session. Since session is supported
by PHP by default you don't need to configure anything to use it but
you do need to use a recent version of PHP. By recent i mean greater than
PHP 4.3.2. Using lesser than that version may cause the script to work only
occassionally ( sometimes it won't work at all ). Don't ask me what cause
that cause i don't about the reason too :-)
For the third method you will need GD library which is already bundled in
PHP but you will need to enable the GD support before using the library.
To see if GD library is already enabled save the following code, execute
it, and see what the result is
<?php
if (function_exists('imagecreate')) {
echo "GD Library is enabled <br>\r\n<pre>";
var_dump(gd_info());
echo "</pre>";
} else {
echo 'Sorry, you need to enable GD library first';
}
?>
If GD is not enabled yet open up php.ini and search for "extension=php_gd2.dll"
( without the quotes ). Uncomment the line by removing the semicolon ( ; ).
After restarting your webserver try running the test script again. You should
see the message saying that GD is enabled.