SunQuest
           PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old May 7th, 2008, 11:42 AM
sinisa's Avatar
sinisa sinisa is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 78 sinisa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 25 m 47 sec
Reputation Power: 2
How to prevent double voting/rating(hot or not clone)

Hi,
my question is more about DB/script optimization, because script could(possibly!) work with big number of users/votes/ratings...
My client said that cookies will be fine.
(I know that other ways - sessions and IP tracking have their disadvantages too...)

To be more clear, everyone can vote, there is no registration/login...

And, now i would like your suggestions about implementing of double voting prevention...
What you would do? I have several solutions/suggestions:

1) all data stored in cookie(unique id and id's of pictures which has been rated, script should pull off picture id's from cookie)

2) cookie+DB -1.way
All ratings/votes from same user in one field/one row!
TABLE STRUCTURE:
id,unique_id,picture_ids(separated by commas)
for example
1, 1uu2145u55, 1,2,4,5,6

This way is good when there is no too many votes, but you can imagine what will be with number increasing...
(i am using explode() function to get rated images id's)

3) cookie+DB -2.way

EVERY RATING - ONE ROW IN DB

same db structure, but:
id,unique_id,picture_ids(separated by commas)
for example:
1, 1uu2145u55, 1
1, 1uu2145u55, 2
1, 1uu2145u55, 3

Sorry for my English, i hope that you understand what i tried to say.

So, what you would suggest?Is there any other(better) way?
Thanks in advance!
__________________
http://www.sinisake.com

Reply With Quote
  #2  
Old May 7th, 2008, 07:17 PM
icandothat's Avatar
icandothat icandothat is offline
Moderator
Click here for more information.
 
Join Date: Apr 2007
Location: San Diego, CA
Posts: 1,548 icandothat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 2 h 20 m 4 sec
Reputation Power: 3
Do not do comma separated values in a database. That's why a database exists. If you were going to do comma separated values you could use a text file. Anyway, I would suggest a table

votes
-------
user_id (integer)
vote (integer)

if you index this table on both the user_id and the vote, it will still get big but I think it will remain manageable. You could then use some kind of caching in temp tables when a user logs in . so, when the user logs in, you make a temp table with their user_id. and that way you're not querying against every users votes only this users votes. Furthermore you could query the id's of the images the user has voted on then save those in an ordered array in the session to be checked when each images loads and that way you wouldn't even present the option to vote on the page.
__________________
There is no spoon.

Reply With Quote
  #3  
Old May 7th, 2008, 08:11 PM
sinisa's Avatar
sinisa sinisa is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 78 sinisa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 25 m 47 sec
Reputation Power: 2
Thank you very much, i will then choose third way, i haven't used temp tables before, but maybe it is time to learn something new.

Reply With Quote
  #4  
Old May 8th, 2008, 06:05 PM
icandothat's Avatar
icandothat icandothat is offline
Moderator
Click here for more information.
 
Join Date: Apr 2007
Location: San Diego, CA
Posts: 1,548 icandothat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 2 h 20 m 4 sec
Reputation Power: 3
right on. Learning is earning.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > How to prevent double voting/rating(hot or not clone)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway