Changeset 2099


Ignore:
Timestamp:
Sep 20, 2007, 3:00:16 AM (17 years ago)
Author:
rvelices
Message:
  • fix very rare sql error (duplicate key) for rating
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1_7/include/functions_rate.inc.php

    r1903 r2099  
    5151  }
    5252
     53  $ip_components = explode('.', $_SERVER["REMOTE_ADDR"]);
     54  if (count($ip_components) > 3)
     55  {
     56    array_pop($ip_components);
     57  }
     58  $anonymous_id = implode ('.', $ip_components);
     59
    5360  if ($user_anonymous)
    5461  {
    55     $ip_components = explode('.', $_SERVER["REMOTE_ADDR"]);
    56     if (count($ip_components) > 3)
    57     {
    58       array_pop($ip_components);
    59     }
    60     $anonymous_id = implode ('.', $ip_components);
    61 
    6262    if (isset($_COOKIE['pwg_anonymous_rater']))
    6363    {
     
    7979  WHERE user_id = '.$user['id'].'
    8080    AND anonymous_id = \''.$_COOKIE['pwg_anonymous_rater'].'\'
    81     AND element_id NOT IN ('.implode(',', $already_there).')
     81    AND element_id IN ('.implode(',', $already_there).')
    8282;';
    8383           pwg_query($query);
     
    117117  AND user_id = '.$user['id'].'
    118118';
    119   if (isset($anonymous_id))
     119  if (isset($user_anonymous))
    120120  {
    121121    $query.= ' AND anonymous_id = \''.$anonymous_id.'\'';
     
    129129  ('
    130130    .$user['id'].','
    131     .(isset($anonymous_id) ? '\''.$anonymous_id.'\'' : "''").','
     131    .'\''.$anonymous_id.'\','
    132132    .$image_id.','
    133133    .$rate
Note: See TracChangeset for help on using the changeset viewer.