Jump to content

how to avoid multi-user editing a webpage


pinxxx

Recommended Posts

Use fopen and flock. The file will be locked until unlocked or closed. If it cant get a lock its best to let it sleep for a microsecond or so otherwise the script will keep trying. But because you have it locked does not mean that another user cant open it, they can, they just cant write to it.

 

 

HTH

Teamatomic

What exact method are you using to edit the web page? A programming editor running on a computer or a web form in a browser? Are you actually editing the source of the page or are you editing content in a database that a web page then displays?

 

In general, you would need to use a semaphore in a file or a database to restrict access to one person at a time. Since php functions like flock release the lock when the script on a page ends, they would not directly be usable if a web form is being used to edit the web page in question.

im creating a program that a user can add/edit data in my webpage. but they are requesting to avoid multi user to edit a data. im currently using a database to store a counter for the data that is in use by a user and i only allow one user to edit a data in my webpage. i just want to think of some way to do that and i've searched in google and they're suggesting the same thing... there are other methods but i can't really understand it.. :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.