I need help getting started with some PHP coding. I am writing an app for Facebook that requires voting. I’ve got the whole framework up and working and I’ve created functionality where the user can click under a photo to vote on it. The client wants people to be able to vote for as many photos as they like but I need to figure out how to limit it so they can’t vote for the same one over and over again.
My first thought was that I would set the SESSION variables to somehow link to the Facebook user’s account so the app could identify the person but I’m trying to create more of a ‘custom tab’ than an actual app. If the only method to do this is by create an app where the user has to opt-in, then so be it, but I was wondering if there’s a way to set a cookie and do this without the user logging into to the app or the app having to be opted in to.
As you can tell, I’m pretty new to PHP and MySQL coding so I’m still learning.
Thanks for pointing me in the right direction!
You probably can find what cookies FB uses and hack it to get the user id but it’s a bad thing to do and it probably violates FB terms.
A much better approach to create an engaging experience for your users would be to create a FB app and ask your users to accept if they want to vote.
In order to make them have a better experience, I suggest you the following flow:
When the user clicks the voting button, you check if he has accepted your app and prompt him to do so, in case he hasn’t.
When he accepts you app, you grab his data, put it in your db and check if there’s already a relationship between the user and the thing to be voted and act accordingly (if the user has already voted for that item, you don’t compute the double vote and inform him).