Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Semaphores

Codes here !

Moderators: macek, egami, gesf

Semaphores

Postby Mixamajic » Thu Feb 06, 2003 3:01 pm

I have a website/program that allows users to edit information in a mysql database. I would like to implement some sort of session control. What happens is when a person clicks on a link a form appears where they can edit/add information. I do not want two users to open the same form at the same time. Each form corresponds to a single row in the database. I wanted to do something like semaphores but my concern is that users may leave sessions open. Then I thought about time outs,.. but if a user leaves a session open, a timeout occurs, then another user opens the same form then two people are in the same session. Has anyone handled anything like this?
Mixamajic
New php-forum User
New php-forum User
 
Posts: 9
Joined: Sun Feb 02, 2003 6:54 pm
Location: Milwaukee

Postby Hurkle » Thu Feb 06, 2003 3:38 pm

hmm..

when a user opens a form, you could record that that record is checked out, the time, and the user. If someone else trys to open a checked out record, check and see if the time that a record is allowed to be checked out has expired with no changes from the original user. If 2 hours have gone by(for example), and the first person who checked out a record hasn't done anything with it, they're probably just leaving it sitting there.

When a user goes to save the changes they've made to the record, check and see if that record is still checked out to them, or if they waited too long and someone else has it checked out.

I hope this makes sense.. If not do some searches on document managers and CVS systems. Good luck..
Hurkle
New php-forum User
New php-forum User
 
Posts: 36
Joined: Tue Jan 07, 2003 8:45 am
Location: Minnesota, USA

Postby Mixamajic » Thu Feb 06, 2003 7:15 pm

I agree with your suggestion. It doesn't look like any PHP functions are directly going to help. Thanks for your input.

on record open -> if id already exists in table verify two hours have passed. If so, update id, time, user in DB, else no access. If row does not exist add row and open session.

on edit -> verify user is listed in record for ID

on record close ->remove record id
Mixamajic
New php-forum User
New php-forum User
 
Posts: 9
Joined: Sun Feb 02, 2003 6:54 pm
Location: Milwaukee


Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.