Chris Fodor
Chris Fodor

Reputation: 117

See who is on the same page in CodeIgniter

I am using CodeIgniter and I connect to a remote database. Only people who are in the table "users" are allowed to log in through session. Some of the tables in the DB can be edited on the site and a form sends the info to the Model (which then updates the info to the DB), what I want to do is the site to tell you who is on the edit page aswell like "John Doe is already editing this table". Is it possible to achieve it with session or something else?

Thankfull for any response.

Upvotes: 1

Views: 52

Answers (1)

Mike J
Mike J

Reputation: 425

You can get the current URI with this method (be sure to load the URI helper):

$this->uri->uri_string();

Then I would keep a users table, since they're required to log in, you should already have this, then also keep a field which indicates whether they are logged in or not, then a nullable field indicating which page they are on. Then when you're on an admin/edit page, you can query all users which page = {admin/edit page}, and display which users are on this page.

Let me know if you have any other questions.

Upvotes: 1

Related Questions