|
Posted by David on 07/04/06 09:34
On Sun, 02 Jul 2006 09:29:58 +0100, Geoff Berrow
<blthecat@ckdog.co.uk> wrote:
>Message-ID: <44a702ec$0$9791$88260bb3@free.teranews.com> from Possum
>contained the following:
>
>>I would like to have a members database for log ons into members areas.. How
>>do you create and impliment such a database..
>
>Storing usernames and passwords
>1. Write table to contain member details.
>2. Write code to add details and ensure that username is unique
I am using MySQL 5 with PHP 5. While running some test programs, I
noticed that it is not necessary to write any code which ensures that
a field is unique--if the field is defined as a primary key. It is
only necessary to check the error number that is returned, if there
was an error. I should point out that I am using mysqli, and not the
mysql library. It is also worth pointing out that if you are running
mysql 5 and php 5, it is necessary to use use the php_mysqlilib.dll
and not the php_mysqllib.dll.
>Logging in
>3. Create form to capture username and password.
>4. Check db. If there is one row that matches username and password set
>session variable to true or record a timestamp in the table.
>On each protected page
>5.check for session variable or that timestamp is not older than a time
>of your choosing.
>6. If all ok, load page (reset timestamp if used) else redirect to login
>page
David
[Back to original message]
|