Page 1 of 1
Help with locking mechanism via web page
Posted: Tue Feb 08, 2005 10:49 am
by Nemesis
Hello, I need a little help.
My Web Services system has an applet running in the background, but I cannot assume that everyone will have Java enabled.
I need a reliable way to implement a locking mechanism (which will consist of calling lock and unlock functions of my middleware layer).
I am not very experienced in PHP, and I need to do this on the page level. I cannot use sessions, because I need only to lock on certain specific pages, to allow maximum availability of the system from multiple users.
Can anyone suggest a way for me to accomplish this?
Thank you,
Nemesis.
Posted: Tue Feb 08, 2005 10:51 am
by feyd
how are these pages built? Some architecture details would be quite helpful.
Posted: Tue Feb 08, 2005 10:59 am
by Nemesis
They are built in a non-OO old-school PHP way.
Every PHP file represents one or a few web pages, depending on variables etc.
If this was a project that I had built myself, I would be ashamed

Posted: Tue Feb 08, 2005 11:03 am
by feyd
okay... and the lock needs to always be on with these specific pages? If so, then you can directly add the locks to those scripts, or based on the inputs passed.. simple if's for the latter.
Posted: Tue Feb 08, 2005 11:07 am
by Nemesis
Yes, this is a solution that I had hoped would work.....sorry if I was not specific enough,
The problem is that I need to call an unlock function if the user navigated to an unlocked page.
So I need a way to call a function when the page is changed, when the page is closed, when the browser is closed, etc.
And this needs to be reliable, otherwise I will end up with eternally locked objects (until I unlock them manually

)
Posted: Tue Feb 08, 2005 11:23 am
by feyd
okay. database sessions are the direction to go. Is this lock system wide? It would appear so. If you can change it to a friendly session level lock or request based lock it would probably be easier and more reliable to implement. You'll need sessions to know if they have navigated away/closed the browser after a period of inactivity.
When the database session is removed, the last page they were on should be checked against the lock list and call unlock when needed.. or better yet just always call unlock.
Posted: Tue Feb 08, 2005 12:25 pm
by Nemesis
Sorry, I dont know what a Database session is.
Furthermore, there are no databases accessible from the Web page. These are back end things, and the Web never has database connectivity.