Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 665481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:42:46+00:00 2026-05-13T23:42:46+00:00

I am developing a user manager which must control access to the detail view

  • 0

I am developing a user manager which must control access to the detail view of editable items. At present, when a user clicks ‘edit’, the application queries the link table to check if a user is currently editing that page, if not, it allows access to the page and then inserts a record into the link table preventing another user from editing the same page at the same time.

My question is what would the best way to handle the removal of records if say a user exists the browser without saving etc, therefore no action to remove the record.

I have a couple of ideas but would like other input before I decide.

BenTheDesigner

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:42:47+00:00Added an answer on May 13, 2026 at 11:42 pm

    A simple timeout. Have a field last_seen in the table and update it with the current time when the user performs an action. Then, you can check if the last_seen field is over 15 minutes or so old, delete the record.

    Some pseudo-ish code:

    edit_something() {
    
        // Assume there's a lock
        $is_editable = false;
    
        // Check if lock exists
        $q = mysql_query("SELECT * FROM linktable WHERE item_id = 2");
    
        // If a lock exists
        if(mysql_num_rows($q) > 0) {
    
            // Check if it's timed out
            $r = mysql_fetch_assoc($q);
    
            // Delete lock if it's over 15 minutes old
            if(time() - $r > 15 * 60) {
                mysql_query("DELETE FROM linktable WHERE item_id = 2");
                $is_editable = true;
            }
        } else {
            $is_editable = true;
        }
    
        if($is_editable) {
            // Lock for current user
            mysql_query("INSERT INTO linktable SET item_id = 2, user_id = 5, last_seen = NOW()");
        } else {
            echo "Sorry, it's locked.";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a user control (ascx) in ASP.NET which uses javascript for manipulating
I am developing an application suite that consists of several applications which user can
I am currently developing a GTK# application which will use a component to view
I am developing an application which is based on user challenges. The app also
I am developing an application that allows for a user to manage some individual
I'm developing user control in C# Visual Studio 2010 - a kind of quick
I'm developing a user preferences page and I've decided to use AngularJS to control
I am developing a WPF User Control for displaying portions of XML files. I'm
I am developing an web application which can upload/download a file from client to
I would like to implement per-directory quotas for a multi-user web application we're developing.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.