Re: login script using file, not mysql [message #171609 is a reply to message #171603] |
Tue, 11 January 2011 23:50 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 11/01/11 21:17, Luuk wrote:
> On 11-01-11 22:04, Denis McMahon wrote:
>> You can write a password / access control system in php that uses a
>> plain text file to store passwords, but there are issues with doing so,
>> one of which is the need to allow concurrent write access to the file if
>> two users decide to update their passwords at once.
> if 'write access' is needed to the file
>> Using a suitable database avoids such issues.
> than 'write access' is also needed for the database
> so, using a database, and not a file, dose not avoid such issues....
Yes it does, because a database is designed to handle record locking and
concurrent accesses.
Added to this, in a database, to update a single password field in a
table you don't need to read in, update, and write out a whole file, and
as long as two people don't try and update the same record in a database
at once, concurrency and locking should not be an issue.
If two people are trying to update the same password at once, something
weird is happening.
Rgds
Denis McMahon
|
|
|