Check if a user already voted [closed]

Creating a table for such functionality in WordPress is not an efficient move. I would prefer to do this using follwoing approach.

  1. Create Custom post type for your voters info. For this you can try Generate WP post type generator.

  2. When ever user visits your site; save IP and rating in post meta using wp insert post and add_post_meta. In this way you will be able to view the list in back-end as well.

  3. Every time when user visits your site check if there is some user with that IP using WP Query. If it exist no need to add info else add his info using step 2.

Here is a simple function to get ip of your user;

function get_the_user_ip() {

    if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
    //check ip from share internet
    $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
    //to check ip is pass from proxy
    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
    $ip = $_SERVER['REMOTE_ADDR'];
    }

    return $ip;

} 

Hope this might work for you.