pinxxx Posted February 2, 2010 Share Posted February 2, 2010 how can i let only one user to edit/access a webpage in a network and lock it until the user is done? please help.. Quote Link to comment https://forums.phpfreaks.com/topic/190637-how-to-avoid-multi-user-editing-a-webpage/ Share on other sites More sharing options...
teamatomic Posted February 2, 2010 Share Posted February 2, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/190637-how-to-avoid-multi-user-editing-a-webpage/#findComment-1005403 Share on other sites More sharing options...
PFMaBiSmAd Posted February 2, 2010 Share Posted February 2, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/190637-how-to-avoid-multi-user-editing-a-webpage/#findComment-1005407 Share on other sites More sharing options...
pinxxx Posted February 3, 2010 Author Share Posted February 3, 2010 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.. Quote Link to comment https://forums.phpfreaks.com/topic/190637-how-to-avoid-multi-user-editing-a-webpage/#findComment-1005824 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.