Lester Chan's Forums
06 January 2009, 11:17 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Become a fan of Lester Chan's WordPress Plugins in Facebook.
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: want users to be able to vote once a day...some are cheating by erasing cookie..  (Read 3469 times)
0 Members and 1 Guest are viewing this topic.
bloginterviewer
Newbie
*
Offline Offline

Posts: 23


View Profile
« Topic Start: 28 July 2007, 00:24 »

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: 8,204



View Profile WWW
« Reply #1: 28 July 2007, 06:50 »

Do a IP check with date

Openup postratings.php:
Find:
Code:
$get_rated = $wpdb->get_var("SELECT rating_ip FROM $wpdb->ratings WHERE rating_postid = $post_id AND rating_ip = '".get_ipaddress()."'");
Replace:
Code:
$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
« Reply #2: 28 July 2007, 13:33 »

Thanks, I just put the code in.  Let's see how it works.

Mike
Logged
bloginterviewer
Newbie
*
Offline Offline

Posts: 23


View Profile
« Reply #3: 28 July 2007, 13:59 »

Put the code in.

I voted, deleted the cookies, and it let me vote again...any suggestions?
Logged
Ttech
Official Support
Administrator
*****
Offline Offline

Posts: 4,294



View Profile WWW
« Reply #4: 28 July 2007, 14:03 »

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: 8,204



View Profile WWW
« Reply #5: 28 July 2007, 15:49 »

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
Administrator
*****
Offline Offline

Posts: 4,294



View Profile WWW
« Reply #6: 28 July 2007, 16:00 »

Echo. Tongue
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
« Reply #7: 28 July 2007, 16:15 »

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
« Reply #8: 28 July 2007, 17:08 »

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
« Reply #9: 28 July 2007, 17:17 »

Once this is fixed I'll stop pestering you...for today  Grin
Logged
GaMerZ
lesterchan.net
Administrator
*****
Offline Offline

Posts: 8,204



View Profile WWW
« Reply #10: 28 July 2007, 17:27 »

Try this replacement:
Code:
$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
« Reply #11: 28 July 2007, 17:34 »

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
« Reply #12: 28 July 2007, 17:49 »

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: 8,204



View Profile WWW
« Reply #13: 28 July 2007, 17:59 »

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
« Reply #14: 28 July 2007, 18:05 »

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: 8,204



View Profile WWW
« Reply #15: 28 July 2007, 18:17 »

yeap =)
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
Administrator
*****
Offline Offline

Posts: 4,294



View Profile WWW
« Reply #16: 29 July 2007, 13:33 »

Smiley
Logged

Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.04 seconds with 23 queries.