diff options
Diffstat (limited to '')
-rw-r--r-- | include/functions_rate.inc.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/include/functions_rate.inc.php b/include/functions_rate.inc.php index 3fe1a668e..4d7f756b7 100644 --- a/include/functions_rate.inc.php +++ b/include/functions_rate.inc.php @@ -50,15 +50,15 @@ function rate_picture($image_id, $rate) return; } - if ($user_anonymous) + $ip_components = explode('.', $_SERVER["REMOTE_ADDR"]); + if (count($ip_components) > 3) { - $ip_components = explode('.', $_SERVER["REMOTE_ADDR"]); - if (count($ip_components) > 3) - { - array_pop($ip_components); - } - $anonymous_id = implode ('.', $ip_components); + array_pop($ip_components); + } + $anonymous_id = implode ('.', $ip_components); + if ($user_anonymous) + { if (isset($_COOKIE['pwg_anonymous_rater'])) { if ($anonymous_id != $_COOKIE['pwg_anonymous_rater']) @@ -78,7 +78,7 @@ DELETE FROM '.RATE_TABLE.' WHERE user_id = '.$user['id'].' AND anonymous_id = \''.$_COOKIE['pwg_anonymous_rater'].'\' - AND element_id NOT IN ('.implode(',', $already_there).') + AND element_id IN ('.implode(',', $already_there).') ;'; pwg_query($query); } @@ -116,7 +116,7 @@ DELETE WHERE element_id = '.$image_id.' AND user_id = '.$user['id'].' '; - if (isset($anonymous_id)) + if (isset($user_anonymous)) { $query.= ' AND anonymous_id = \''.$anonymous_id.'\''; } @@ -128,7 +128,7 @@ INSERT VALUES (' .$user['id'].',' - .(isset($anonymous_id) ? '\''.$anonymous_id.'\'' : "''").',' + .'\''.$anonymous_id.'\',' .$image_id.',' .$rate .',NOW()) |