/    Sign up×
Community /Pin to ProfileBookmark

Limit web form to one user at a time

Is there a way to limit a web form to only one user at a time. Can you monitor the form in some way and maybe just disable the submit button or some other process?
Any ideas welcome.

Thanks

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@sushiAug 29.2008 — yep. you definitively need a database for this. Everytime a user access the form page, add a flag to a table, and check for the flag everytime anyone access the form.
Copy linkTweet thisAlerts:
@konithomimoAug 29.2008 — you will have to use a server-side script. I recommend PHP. JavaScript is client-side, so it runs locally in the user's browserr and has no communication with the backend (server-side). you do not even need a database. you just need to use sessions.
Copy linkTweet thisAlerts:
@sushiAug 29.2008 — you will have to use a server-side script. I recommend PHP. JavaScript is client-side, so it runs locally in the user's browserr and has no communication with the backend (server-side). you do not even need a database. you just need to use sessions.[/QUOTE]

how will you access the current user's session if when you initialize the second's user session (session start) the session is empty?
Copy linkTweet thisAlerts:
@konithomimoAug 29.2008 — 
  • 1. PHP can access all session, since they are stored in a folder above the default http directory. you can check every session for a specific value, which you only allow 1 user to have at a time


  • 2. you can create a directory to check. if there is a file in the directory then a user is using the form, if not then noone is using the form. once a user tries to access the form just check the directory. if the directory is empty then create a file in it and let them use the form.


  • 3. you can use a DB.


  • some user do not like to, or cannot use a DB, for whatever reason. using a DB isn't the only method, in some cases it is the better choice though.
    Copy linkTweet thisAlerts:
    @simoraauthorAug 29.2008 — I will be using Ms Excel to get the form data. I cannot use Access. Is there another way to get PHP to do this along with javascript.

    Maybe everyone can see the form, but php will only show the Submit Button to the one user who came to the form first.

    I'm still getting my head around dealing with the PHP sessions issue.

    Thanks
    ×

    Success!

    Help @simora spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.28,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...