Welcome Guest, Not a member yet? Register   Sign In
CI Sessions and Company-Specific Data
#1

[eluser]derekmichaeljohnson[/eluser]
I have a "dashboard" controller which displays company-specific information based on the ID passed to the URI.

Code:
ID       Company           Access Code
1        Orange, Inc.      123
2        Grape, Inc.       456

etc, etc
But I don't want just anyone to be able to see ANY company's information, hence the "access code" field. What's the best way, using CI Sessions, to display the appropriate information IF the correct access code has been entered?

I was thinking a login form with a dropdown of all the companies and a password field. ONCE the password is validated, the ID of the company is stored in his/her session. Then in my controller, I display the company information BASED ON the company ID stored in the session (if there is one). If there isn't, it redirects to the login page.

Any suggestions for making this more efficient or even easier?
#2

[eluser]Aniket[/eluser]
this should be enough for getting the things up and running.....if you wish you can have an array which stores only information specific to company or companies.....what achieved by this is all data related to a particular company would be stored in a single array.....without using too many variables in the session.
#3

[eluser]derekmichaeljohnson[/eluser]
All the information is stored in a database, which the controller passes to the view. So, for example, I have a "Meeting Minutes" table:

Code:
ID     Company ID     Title                        Body
1      3              Annual Meeting Minutes       Some text

The controller pulls all data pertaining to a single company, and displays it to the user.




Theme © iAndrew 2016 - Forum software by © MyBB