FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » file access permission?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: file access permission? [message #170085 is a reply to message #170074] Sat, 09 October 2010 09:53 Go to previous message
jussist(at)gmail(dot)com is currently offline  jussist(at)gmail(dot)com
Messages: 1
Registered: October 2010
Karma:
Junior Member
On Oct 7, 9:50 pm, Amit Prakash Pawar <amitppawar2...@gmail.com>
wrote:
> I want to create simple file program.
>
> Suppose i have 10 users. and file xyz.txt
>
> When 1st user access file he has authority to read and write.
> but if at the same time 2nd user try to access this file.
> i have to give only read access or put message like wait 1st users
> writing some operation.
>
> How to create such program in PHP.
>
> Please tell me which concept i want to use or any reference tutorial?

How about just simple database table, in which you track the locking?

Tables:
LOCKING:
filename | Contains the filename that is being locked.
user_locking | User id that has the file open. If null, not locked.
lock_started | Timestamp when lock started.
last_action | Timestamp when locking user was active.

When user saves, update all fields to null, or just delete the row. If
user has been inactive for x minutes, clear the lock.

Something similar for queue.
filename | Filename that access has been requested.
user_id | User id in the queue.
requested | Timestamp when access was requested, but denied due to
the locking.

-jussi
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Can anyone recommend a good debugger & IDE for PHP?
Next Topic: Send .csv file to browser
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 07:37:51 GMT 2024

Total time taken to generate the page: 0.05555 seconds