Jump to content

Retreive IP address and add it to database as array


Merdok

Recommended Posts

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.