Lester Chan's Forums

Please login or register.

Login with username, password and session length
Pages: [1] 2   Go Down

Author Topic: want users to be able to vote once a day...some are cheating by erasing cookie..  (Read 4696 times)

0 Members and 1 Guest are viewing this topic.

bloginterviewer

  • Newbie
  • *
  • Offline Offline
  • Posts: 23
    • View Profile
So on http://www.bloginterviewer.com users are allowed to vote once a day due to a cookie that is stored on their computer.  Unfortunately some have figured out that you can simply erase the cookie and vote multiple times.  Is there any way to prevent this?
Logged

GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Offline Offline
  • Posts: 10,040
    • View Profile
    • WWW
Do a IP check with date

Openup postratings.php:
Find:
Code: [Select]
$get_rated = $wpdb->get_var("SELECT rating_ip FROM $wpdb->ratings WHERE rating_postid = $post_id AND rating_ip = '".get_ipaddress()."'");Replace:
Code: [Select]
$get_rated = $wpdb->get_var("SELECT rating_ip FROM $wpdb->ratings WHERE rating_postid = $post_id AND rating_ip = '".get_ipaddress()."' AND rating_timestamp  > ".current_time('timestamp')-(24*60*60));
Logged

++ lesterchan.net - Lester Chan's Website

I DO NOT provide support for any modifications of any plugin to meet your needs/requirements, unless it is a paid job and I have the time to do it due to the large number of request.

bloginterviewer

  • Newbie
  • *
  • Offline Offline
  • Posts: 23
    • View Profile
Thanks, I just put the code in.  Let's see how it works.

Mike
Logged

bloginterviewer

  • Newbie
  • *
  • Offline Offline
  • Posts: 23
    • View Profile
Put the code in.

I voted, deleted the cookies, and it let me vote again...any suggestions?
Logged

Ttech

  • Official Support
  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 4,294
    • View Profile
    • WWW
Do you have the ip check option checked?
Logged
Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers

GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Offline Offline
  • Posts: 10,040
    • View Profile
    • WWW
did u choose logged by IP and Cookie
Logged

++ lesterchan.net - Lester Chan's Website

I DO NOT provide support for any modifications of any plugin to meet your needs/requirements, unless it is a paid job and I have the time to do it due to the large number of request.

Ttech

  • Official Support
  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 4,294
    • View Profile
    • WWW
Logged
Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers

bloginterviewer

  • Newbie
  • *
  • Offline Offline
  • Posts: 23
    • View Profile
I did choose both, then I went to change it to just ip.  I think that will work, right?

But now I'm just trying to get it to function again: http://forums.lesterchan.net/index.php/topic,809.60.html
Logged

bloginterviewer

  • Newbie
  • *
  • Offline Offline
  • Posts: 23
    • View Profile
Okay, I got it to work right the normal way, but I changed the code like our recommended above and got this error:



WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-86400' at line 1]
-86400
Logged

bloginterviewer

  • Newbie
  • *
  • Offline Offline
  • Posts: 23
    • View Profile
Once this is fixed I'll stop pestering you...for today  ;D
Logged

GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Offline Offline
  • Posts: 10,040
    • View Profile
    • WWW
Try this replacement:
Code: [Select]
$get_rated = $wpdb->get_var("SELECT rating_ip FROM $wpdb->ratings WHERE rating_postid = $post_id AND rating_ip = '".get_ipaddress()."' AND rating_timestamp  > '".(current_time('timestamp')-(24*60*60))."'");
Logged

++ lesterchan.net - Lester Chan's Website

I DO NOT provide support for any modifications of any plugin to meet your needs/requirements, unless it is a paid job and I have the time to do it due to the large number of request.

bloginterviewer

  • Newbie
  • *
  • Offline Offline
  • Posts: 23
    • View Profile
Thanks, no more error message.  Now it's time to see if it lets me vote again in 24 hours.

Mike
Logged

bloginterviewer

  • Newbie
  • *
  • Offline Offline
  • Posts: 23
    • View Profile
Hey,

Should I have it by IP and Cookie for this?  Is that more secure or will it mess things up?
Logged

GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Offline Offline
  • Posts: 10,040
    • View Profile
    • WWW
yes IP/Cookie
Logged

++ lesterchan.net - Lester Chan's Website

I DO NOT provide support for any modifications of any plugin to meet your needs/requirements, unless it is a paid job and I have the time to do it due to the large number of request.

bloginterviewer

  • Newbie
  • *
  • Offline Offline
  • Posts: 23
    • View Profile
Thanks,

I do believe you also have to replace this, too:

In postratings.php
Find:
Code:

$rate_cookie = setcookie("rated_".$post_id, 1, time() + 30000000, COOKIEPATH);

Replace:
Code:

$rate_cookie = setcookie("rated_".$post_id, 1, time() + 86400, COOKIEPATH);



I just wanted to make sure others know...I'm correct, right?
Logged

GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Offline Offline
  • Posts: 10,040
    • View Profile
    • WWW
Logged

++ lesterchan.net - Lester Chan's Website

I DO NOT provide support for any modifications of any plugin to meet your needs/requirements, unless it is a paid job and I have the time to do it due to the large number of request.

Ttech

  • Official Support
  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 4,294
    • View Profile
    • WWW
Logged
Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers

skyman

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
    • View Profile
I've have recently upgraded to 2.7.1 however I've been having this same issue as well even before the upgrade. I tried the methods in this post and still can revote after erasing cookies. Does anybody have a fix for this, it's irritating that users can vote multiple times on the same post via this problem. Thanks.
Logged

GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Offline Offline
  • Posts: 10,040
    • View Profile
    • WWW
You can logged by IP and Cookie. There is not such thing as fail proof way. Even going through proxy or deleting cookie or ADSL (where IP keep changing) there is no 100% to prevent it.
Logged

++ lesterchan.net - Lester Chan's Website

I DO NOT provide support for any modifications of any plugin to meet your needs/requirements, unless it is a paid job and I have the time to do it due to the large number of request.

skyman

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
    • View Profile
I'm sure there is, I've seen rating systems used on WP before that do not allow to re-vote after wiping out cookies. Only problem is, I have this integrated through my WordPress and static site and I would hope there's a fix for it rather than having to find another rating system to go with.
Logged
Pages: [1] 2   Go Up
« previous next »
 

Page created in 0.039 seconds with 24 queries.