Forum Moderators: coopster

Message Too Old, No Replies

Sharing session data between users?

         

fintan

1:59 am on Jan 20, 2007 (gmt 0)

10+ Year Member



Is there a way to do this? I want to track if user(s) inserts/update/deletes a record & share it with every other user logged in. Then do some fancy stuff ;)

cameraman

6:26 am on Jan 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't think of a 'magical' way to do it. It wouldn't be too hard to do, really, except that you'd have to make it part of every page load and every database operation.

I'd set up two tables. The first, a log table with fields for who done it, what and when it was done. The second, who's seen what. Then the fun part: hunt down every insert, update, and delete, and set up an add to the log table.

But wait, now it gets tedious. Write a moderately short piece of code that you'll need to paste into every page on the site, which looks to see if $thisperson has seen all the actions in the log table. Alternatively you could add a field to the user table (I'm assuming that if people 'log in' then each must have a record somewhere which holds his/her password and such) which simply lists the last action number $thisperson has seen. Then if the action number in the log table is higher than the number in the user's record, you can flash a message wherever on the currently viewed page, concise or verbose as you desire.

Some of those javascript folk might have a slick way for you to check on a periodic basis; me, I'd just do it during page changes.