single to multiple users
Posted by TedH (TedH), 7 September 2006Hi, I have a script which has username and password access. It works fine for just one user. The details pass sucessfully to every sub-routine.
I want to make it so it can work for multiple users (several could be using it at the same time). A flat-file db can hold the details - for instance:
( I can open this and read in all the records - from there on I haven't a clue.)
I don't know how to make it so that the $username and $password variables pick up the input from the form and keep them throughout that user's time in the script. I know cookies are insecure so they're no good. It just seems if I can make this so it retains the details like the original, it should work.
Or am I approaching this all wrong?
This is the scriptthe shortest I can make it for posting here)
Hope someone can help, many thanks - Ted
Posted by admin (Graham Ellis), 7 September 2006If you're looking to allow (as I think you are) multiple users to log in, each with there own password, then you need to add a loop into your code to check for each username / password in turn in checkAccess. It would return a true value if ANY of the pairs matched, or false if you didn't get a match.
Multiuser brings a whole lot of other additional issues over single user; will all your users have access to the same data, for example, of each their own data area. There are whole books written, I suspect, on the subject. I do think you'll need to think through a lot of issues very carefully as you carry on down this route. Good luck - and of course do ask further questions as and when you need to.
Posted by TedH (TedH), 7 September 2006Hi Graham, I'll have a go at looping the checkAccess. I've just been playing around with matches (m/) and managed to get a response ('cuz I thought why not try this and it worked). That would have to be part of it (I think), as the users will indeed access data.
The database has a user ID as the key for each record and so if a user enters the script only that user's records would show so they can edit or delete them. That side of things is fairly straight forward once I get the validation right.
I hadn't thought of looping in the checkAccess (the brain doesn't work that way) - I was figuring, 'do the stuff then checkAccess'. So I shall set to on that.
many thanks - Ted
Posted by TedH (TedH), 7 September 2006Did you know that an eternal loop makes the fan on your PC work overtime before 5 o'clock
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho