Can This Be Done? - Button That Only Allows One Person To Click It

Discussion in 'Programming' started by Lynxtouch, Jun 15, 2010.

  1. #1
    I am trying to add this thing to my site, but I don't have a clue about how I might do it....

    Essentially, I want to give people the chance to press a button on my site. These people will just be "naked" visitors and will not have an account on my website. When they press this button, I will just process something in the backend of my site... but they cannot press the button again.

    How would you do this?

    Rich
     
    Lynxtouch, Jun 15, 2010 IP
  2. Xisco

    Xisco Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    session variables that stores the (true) if they pushed and false if not, and then it showa or not the button.
     
    Xisco, Jun 15, 2010 IP
  3. Lynxtouch

    Lynxtouch Peon

    Messages:
    156
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply!

    But wud the session var stay even if the user clicked off the site then back onto it?
     
    Lynxtouch, Jun 15, 2010 IP
  4. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #4
    use javascript to disable it on Onclick event

    That all

    I hope that helps


    Regards

    Alex
     
    kmap, Jun 15, 2010 IP
  5. Lynxtouch

    Lynxtouch Peon

    Messages:
    156
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes but how would you stop the button showing up for the same person even when they go off the site and come back
     
    Lynxtouch, Jun 15, 2010 IP
  6. a_person

    a_person Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    $_SESSION? No! The value would be lost when the session expired. Also, using session for a site that does not requires login?! What for?!

    Disable the button onclick event? And if the user reloads the page?

    Cookies? And if the user cleans up the cookie?

    It is better to save in a database the IPs of who have clicked on the button. Then, every time the page is loaded, check if the IP has already clicked on it. If not yet, show the button. If yes, don't show it.

    Yes, the IP can change. But as the users won't have an account, you will have to rely on the IP.
     
    a_person, Jun 20, 2010 IP
  7. WinDrop

    WinDrop Guest

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Exactly, do it via database, save IP and if users are registered then usernames as well and don't show button to IPs which have been clicked the button. ;)
     
    WinDrop, Jun 20, 2010 IP
  8. ASPMachine

    ASPMachine Peon

    Messages:
    723
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Are you looking for this. Here I've made simple script to solve your problem. If you like it, just PM me, I'll sent whole the things.

    thanks
     
    ASPMachine, Jun 21, 2010 IP
  9. phpmatt

    phpmatt Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    IP is the best way to do this but isn't foolproof, I guess it depends onthe application, would the user benefit from multiple clicks. i.e. make it worthwhile trying to circumvent the system or are the users trusted and no negative effects of multiple clicks
     
    phpmatt, Jun 22, 2010 IP
  10. rachel.anthony12

    rachel.anthony12 Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    i think javascript can help u
    you can put it in the OnClick event for the particlular user whom you dont want to allow to click it
     
    rachel.anthony12, Jun 24, 2010 IP