1

I'm using the 1-file version of this project: http://php-login.net

It uses a sqlite *.db file to store the info.

Will it cause issues if two users are trying to register at the same time? Permission errors, etc.? I'm unsure how PHP handles multiple requests happening at once.

Ben
  • 149
  • 10

1 Answers1

2

It will work just fine. PHP runs inside of webservers that handle the work of multiple simultaneous requests. SQLite is also capable of handling multiple simultaneous requests, albeit not as many as a propers SQL server like MySQL.

EDIT

I just checked... The one-file version of PHP-login does have a primary key.

$sql = 'CREATE TABLE IF NOT EXISTS `users` (
        `user_id` INTEGER PRIMARY KEY,
        `user_name` varchar(64),
        `user_password_hash` varchar(255),
        `user_email` varchar(64));
        CREATE UNIQUE INDEX `user_name_UNIQUE` ON `users` (`user_name` ASC);
        CREATE UNIQUE INDEX `user_email_UNIQUE` ON `users` (`user_email` ASC);
        ';
quickshiftin
  • 66,362
  • 10
  • 68
  • 89
  • Using a PK is what OP should use. – Funk Forty Niner Dec 15 '14 at 16:33
  • Pay a little more attention my man, he's using a library that already provides an FK! – quickshiftin Dec 15 '14 at 16:37
  • I don't have to "pay more attention". As if I'm going to go through every single link an OP posts to see whether or not he/she did use the actual SQL included in there. So, we don't know that for sure, now do we? There you go. Without even checking that link, my first comment to the OP "answered" the question. Why even put in an "answer"? – Funk Forty Niner Dec 15 '14 at 16:39
  • I don't think your comment did answer the question, in fact I think it brought up an unrelated subject... And anyway, you can see in 2 seconds that there is a PK already defined lol, so yes, pay more attention. – quickshiftin Dec 15 '14 at 16:45
  • thanks both of you! :) i didn't know sqlite could handle multiple requests - i didn't know if it'd be like two users trying to edit a Word file on a local network share. – Ben Dec 16 '14 at 16:54
  • Here's more detailed info in a [related thread](http://stackoverflow.com/questions/4060772/sqlite3-concurrent-access). – quickshiftin Dec 16 '14 at 17:14