Merdok Posted May 14, 2010 Share Posted May 14, 2010 Hi Guys, I've built a polling mod and following the advice I've been given on here, i'm trying to secure it from vote stuffing by recording the ip addresses of users who have voted. So far I have come up with this: if ($_COOKIE['pollCast'] == $dbp_pollID) { $getIPArray = mysql_query("SELECT ipArray FROM module_poll WHERE pollStatus =1") or die ('Could not retrieve IP Addresses: '.mysql_error()); $IPArray = mysql_fetch_array($getIPArray, MYSQL_BOTH); extract($IPArray, EXTR_PREFIX_ALL, "ip"); $ipUpdate[] = $ip_ipArray; $ipUpdate[] .= $_SERVER['REMOTE_ADDR']; $logIP = mysql_query("UPDATE module_poll SET ipArray = '$ipUpdate' WHERE pollStatus =1") or die ('IP Log failed:' . mysql_error()); } However I'm a bit rubbish when it comes to arrays and the database is only storing 'Array' in the record. Another thing I need to do which I can't get my head around is I ONLY want the ip Address storing if it is not already there. Can anyone give me some help on this matter? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
947740 Posted May 14, 2010 Share Posted May 14, 2010 I don't think you should store an entire array in the database. Make an entry into the database for every ip that tries to vote on the poll, and when checking to see if they have voted, simply see if that IP is in the database anywhere. Quote Link to comment Share on other sites More sharing options...
Merdok Posted May 14, 2010 Author Share Posted May 14, 2010 hmm... I see what you mean, is there a downside to storing the array though? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.