1

I'm developing a basic ERP in PHP for a small firm, they need to maintain accounts of 2 separate companies within it. Working in Code Igniter as I am most familiar with that framework. I need to allow the user to be logged in on both companies at the same time accross tabs, how can I ensure that while saving data from one form it only posts to that company's records? I'm using only one db, with 2 users - hence user_id will be the foreign key in all tables. I need to ensure that when saving an invoice of one company it doesnt take the other company's user_id, which may happen if i use sessions. Would the best approach be to use hidden user_id fields on all forms? Or is there any other method I can use for this?

Thanks :)

echorashmi
  • 81
  • 1
  • 5

2 Answers2

0

You can store the company id in the url, so in the one tab you have

/edit/company/1

and in the ohter

/edit/company/2

Then you can let them choose either one of the companies, and make sure that id is at every url. Make sure that the correct permissions are set though, if you maintain a lot of users/companies.

Luc
  • 331
  • 3
  • 8
0

i think that you can use a global variable, bool i guess and always check after session_start() whether is company 1 or 2

Ed_
  • 973
  • 11
  • 25