473,396 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Multi user environment.

Hello, I am developing a CMS and I would like to be able when a user is
editing a page to inform any other user that the page is being edited by
User X . Ofcourse that's not so difficult if you set a flag in the database
for example that the current document is being edited, and remove the flag
when the user saves the document and exits.

BUT what happens if user exits the editing page without folowing any link or
submit button that I can control. What happens if his computer
restarts/crashes or he kills the browser.

Database will have the document flaged as being edited by User X.

Do you know any good way of avoiding that problem or if you don't already
know, can you think of something similar ?

Thanks Angelos.
Nov 8 '05 #1
6 1729
Hi there Angelos,

You could create a javascript function that sends a signal to the
server when the editing page unloads. onUnload is a standard javascript
event supported by every browser (that has javascript support switched
on).

Alternatively, if your server supports cron jobs, you could create a
program that runs in the background and checks the flag's status every
30 minutes or so. If the status hasn't changed for, say more than 30
minutes, you may assume the user has left the page and the flag should
be reset. This acts as a sort of timeout function.

Kind of a cool problem you are dealing with!

Regards, Maarten

Nov 8 '05 #2
Maarten said the following on 08/11/2005 14:45:
Hi there Angelos,

You could create a javascript function that sends a signal to the
server when the editing page unloads. onUnload is a standard javascript
event supported by every browser (that has javascript support switched
on).
Unfortunately, this isn't failsafe by any stretch of the imagination;
e.g. Javascript disabled, browser crashes, computer crashes, internet
connection lost. I also believe that onUnload is fired if the user
refreshes the page in their browser.

Even if these events only occur once in a day, your database is
immediately unsynchronised, and will probably require manual
intervention to sort it out.

Alternatively, if your server supports cron jobs, you could create a
program that runs in the background and checks the flag's status every
30 minutes or so. If the status hasn't changed for, say more than 30
minutes, you may assume the user has left the page and the flag should
be reset. This acts as a sort of timeout function.


IMO, a cron job is unnecessary. If you store the "check-out" time of
each article in the DB, then you can perform time-out checks can be
performed every time a user requests a PHP page.

e.g. perform the following query at the top of every script:

UPDATE articles
SET isCheckedOut = 0
WHERE (checkOutTime + X) < NOW()

In practice, you can probably find ways to avoid doing this amount of
processing in every script, but you get the general idea...
--
Oli
Nov 8 '05 #3
> Even if these events only occur once in a day, your database is
immediately unsynchronised, and will probably require manual
intervention to sort it out.
IMO, a cron job is unnecessary. If you store the "check-out" time of
each article in the DB, then you can perform time-out checks can be
performed every time a user requests a PHP page. e.g. perform the following query at the top of every script:

UPDATE articles
SET isCheckedOut = 0
WHERE (checkOutTime + X) < NOW()

In practice, you can probably find ways to avoid doing this amount of
processing in every script, but you get the general idea...


I had the same problem, too. I did the cleaning up process through a
php page that was called less frequently, but not as much to keep the
flag On for half a day. By estimate,(not reliable, but the best I could
think of at that time) this page would be run every half or one hour.
After doing all the work the page was supposed to do, it called this
little cleanup() function, something which it was not _supposed_ to do,
but did a good job of.

My question is, is there no daemon creating mechanism in PHP?

Any clues, googling gave this one useful result:
http://www.phpclasses.org/browse/package/2197.html
but not exactly what I am looking for -

making any script or function run continuously.

The only things we have continuously present is the superglobals
$_GET,$_POST,$_SERVER etc.- no code.

Joseph S.

Nov 8 '05 #4
Thanks For all your Answers !!!
It is a hard one ... I haven't found any mechanism to get rid of the
FLAG but I think is one of those things that require the human
intervention. :)

Cheers
Nov 23 '05 #5
Angelos wrote:
Thanks For all your Answers !!!
It is a hard one ... I haven't found any mechanism to get rid of the
FLAG but I think is one of those things that require the human
intervention. :)


What was wrong with the timestamp (i.e. storing the check-out time in
the DB, and automatically resetting documents that have been checked
out longer than time X) suggestion?

--
Oli

Nov 23 '05 #6
Personally, I'd go with checking the timestamp when you want to check
the page out, but you could add in an ajax routine to update the time
stamp every 60 seconds while it is being edited. It could also pick up
and warn the person editing that someone else was trying to get to it.

Ian

Nov 24 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Job Lot | last post by:
In a multi-user environment, how would I prevent users from adding Orders with identical OrderID. For instance I have following tables in my database Order ================== OrderID Identity...
2
by: Scott Bryce | last post by:
I am creating a CGI application in Perl that uses an Access database. It will be hosted on an NT server. I have used flat file DBMs (tied hashes) on UNIX servers, but I am not familiar with how...
9
by: cheryl | last post by:
I am relatively new to programming in Access for a multi user environment, and am having trouble figuring out if there is a way to accomplish one of our user requests. I am working on a multi...
5
by: premmehrotra | last post by:
I currently have a multi-user access database which is put on a shared drive L: on a Windows Servers. Entire database is one file premdb.mdb. Users access this database from their laptops....
4
by: Andy_Khosravi | last post by:
I'm trying to build a search utility for users to find 'inquiries' in my database that involves several tables. This is normally easy to do with the query builder, but I have a unique situation...
7
by: Michael Butscher | last post by:
Hi, this is not really Python-specific but I need it for Python. I'm wanting a method for interprocess communication which is OS- independent (sockets would be the normal way to go), but which...
3
MMcCarthy
by: MMcCarthy | last post by:
I know this question has been covered extensively in the past, but I'm wondering if anyone has any new thoughts on the subject. I have a Frontend/Backend Ms Access database. The frontend will be an...
2
by: john | last post by:
Is it true that if I split my access database in backend and frontend and I implement custom auto increment for the ID fields, that my database is ready to be used in a multi-user environment? I...
7
by: irfanali | last post by:
Hallo All, I m trying to create a Multi User Data Program on Access, where my team members would input data on a daily basis. Well the Problems start now : - How do i create a Multi-user...
0
by: mirandacascade | last post by:
Apologies in advance for what I'm guessing may be a trivial question. Assume the following: 1) multi-user environment 2) standard (i.e. not a class module) module with: Public strSample as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.