this is not so much a coding question but a designquestion how to make the DB:s. I couldnt find a better forum since the design forum is for advanced discussions and this is pretty basic.
Ok so here it goes:
I have a basic login system for my office and now I want to expand the system so my customers can log in as well but I do not know which is the best way to set up the system.
My current database looks like:
USERS (DB NAME)
-ID
-Level (controls who can change or access stuff in the site)
-Name
-PW
-Salt
-Emailverification
-Lastlogin
I also have a DB where I store info about customers like
CUSTOMERS (DB NAME)
- cID (company ID (Uniqe))
- Company name
- Adress, billing adress, and so on
I also want my suppliers to be able to log in (their DB is like customers db with adress info and so on).
The easy way would be to create a user with the name of the company/supplier name and let them log in with that info and steer what they have access to through the USERS->level but I really do not want a common company login but for each company to be able to create and manage their own users.
I thought of adding cID to the USER database since that is unique for each company. So everyone at my office will have cID = 1 for example and everyone from company x will have cID=5 or whichever ID their company have.
Then I can use the cID to determine which information is accessible for the users (I dont want users from company 2 to see the billing info for company 3 for example.
^^ Would this be a good solution or is there a better way? Any other ideas? How do I create the first user for a company (user info that is mailed to the company so they can log in and set up their users, shall i create a DB for temporary users where i delete login info as they set up their first user account or shall i make it as a regular user and the first user they create overwrites the user (temporary name).
Say for example i have Coca Cola as a customer and they have 3 users that should have acess to the system. Should i create a regular useraccount with username Cocacola and cID set to coca cola cID and then their first user (say Adam) overwrites the username Cocacola....
Any ideas what would be the best DB setup is very welcome.
Also every transaction a customer makes (like what he buys and so on) will be saved so it will be lots of transactions.
I was thinking of making a DB called transactions where I store the info and what cID made the transaction. Will this be a bad solution, is it better to create a DB for each company and store only their transactions in there (we have like 2000 customers so that would be lots of databases
Big Thank You in advance!