2

I'm working on an application with multiple roles, admin, faculty and student. Each of them have a unique view of the website according to their roles. An admin's dashboard is different from a faculty member's dashboard, and accordingly, they are redirected to different pages after they log in.

Now, the admin can initiate certain actions, such as accepting applications. When the admin sends an email from his dashboard to students that they can now send the applications, I want that their dashboard be suitably modified ie., the extra option of sending an application is now visible.

So far, I had been dealing with $_SESSION variable for sending data across pages within the same session. But now I want this information to be stored somewhere, so that when the student logs in, that extra option is visible. What seems to be the best way to do this? My application will have at least 2-3 such situations - accepting submissions, asking faculty members to make preferences etc, all depending upon the admin's decisions on when to initiate this.

2 Answers 2

4

You do not need to "pass values from one session to another".

When the admin sends an email from his dashboard to students that they can now send the applications, I want that their dashboard be suitably modified

You simply need to change some state in your application, i.e. the database.

After the dashboard has read that state, it comes down to a simple test:

if (!$user_already_applied) {
    if ($applications_open) {
        // display application form
    }
    else {

    }
}
else {
   // whatever you want to happen...
}
Sign up to request clarification or add additional context in comments.

6 Comments

For every little option like this, will I need to modify the database? And should I create new tables for each such option?
for every little option: Yes, everything you want to remember. new tables: Well, it depends. It always depends on the exact data that you want/need to store.
Consider the case of opening applications. $applications_open should be something I read from the database, so there's a new table for that. Now, for a second option, can the value of that option (usually a true/false type value) be inserted into the same table? It seems like it is possible if I store a (variable_name, boolean_value) pair, but what is recommended? Are there drawbacks to this that I may not have considered?
@Antimony I recommend you ask a new question about how to store the data you need in a database.
Haha. Thanks though. I think I'll try what I have so far!
|
0

$_SESSION is a superglobal varible, and every user can access only one instance of a session, You have to create a role based system, for every role you can mention what type of functionality is accessible for each user when that user uses his own account then only that functionality/pages will be available to them

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.