|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
||||
|
||||
|
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
|
|
#2
|
||||
|
||||
|
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. |
|
#3
|
||||
|
||||
|
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.
|
|
#4
|
||||
|
||||
|
right on. Learning is earning.
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > How to prevent double voting/rating(hot or not clone) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|