Limit to one click per person

2

I want to limit the click of a button to 1 click per computer. Is it possible?

Code so far:

<html>
    <body>
    <br><br>
    <a style="color: grey; background-color: #fff; font-family: Arial; text-decoration: none; padding: 25px 50px; border-radius: 3px;" href="http://hugovales.esy.es/likeme/download_arquivo.php">I Like!</a>
    <br><br><br><a style="color: #fff; font-family: Arial;"><? include "contador_arquivo.txt"; ?> People Enjoy it</a>
    </body>
</html>
    
asked by anonymous 11.06.2015 / 00:22

1 answer

2

Oops, use this javascript:

var createCookie = function(name, value, days) {
    var expires;
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        expires = "; expires=" + date.toGMTString();
    }
    else {
        expires = "";
    }
    document.cookie = name + "=" + value + expires + "; path=/";
}

function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}

Provided by: SOen

After this you can create a function in the click of the link:

<a style="color: grey; background-color: #fff; font-family: Arial; text-decoration: none; padding: 25px 50px; border-radius: 3px;" href="http://hugovales.esy.es/likeme/download_arquivo.php" onclick=" return check()">I Like!</a>

then create a function to validate:

function check(){
    check = getCookie('isclique');
    if(check){
       return false;
    }
    createCookie('isclique','true',100);
}

Something of the genre. I hurried. But this validation is not 100%, the "only" 100% way that is still to cheat but is more secure than this, would validate in the backend.

    
11.06.2015 / 00:45