473,800 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1741
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
1749
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 field CustomerID OrderDate DeliveryAddress
2
2862
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 Access behaves in a multi-user environment. Will I need to use some sort of file locking/semaphore scheme, or does Access (or the ODBC drivers?) manage conflicts between multiple users? I want to avoid corruption of data should multiple users...
9
1717
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 user Access 2002 application. BE db resides on a LAN, FE on each client. The app imports large .csv files containing billing info by date and allows users to run various reports. At a given time, one user may be importing a file into the main...
5
3701
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. Following problems occur: 1. Access is way too slow in WAN environment. Server is located in New Jersey and users are in California and Puerto Rico. 2. Database often becomes corrupt 3. When one user updates some data in the database, other users...
4
3189
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 involving a multi select listbox. Unfortunatly, my SQL skills are somewhat limited, so I'm not sure if there is an easy way around it. To simplify the explanation, I'll simplify the table/field setup to get at the meat of the question. I have a...
7
2058
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 works if multiple users use the machine at the same time so that one user has no access to the communication of programs of another user. Normally any user could connect to an open socket on a machine
3
4481
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 mde. This database will work in a multi user environment but should not be too heavily trafficed. I know I can compact the backend by checking for ldb and compacting file to a copy file then copying back to original. Likewise, I can...
2
5548
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 found a zillion messages about auto increment and read some of them but it's confusing. Can someone point me to a simple custom auto increment example that I can download? Thank you, john
7
3522
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 Environment, so that my Backend is on the Sharedrive(Local Server) and the Front end on the respective user systems? - Well, once i achieve that, then how do i hide the Access data like Tables, Queries and Forms from Viewing by the user on the Front...
0
1295
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 String 3) first user user opens app at 9:00 and runs code that results in setting the variable strSample to "abc"
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10275
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.