Changeset 1992 for trunk/include/functions_rate.inc.php
- Timestamp:
- May 1, 2007, 3:57:52 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_rate.inc.php
r1903 r1992 5 5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 // | branch : BSF (Best So Far) 8 // | file : $RCSfile$ 7 // | file : $Id$ 9 8 // | last update : $Date$ 10 9 // | last modifier : $Author$ … … 60 59 $anonymous_id = implode ('.', $ip_components); 61 60 62 if (isset($_COOKIE['pwg_anonymous_rater'])) 63 { 64 if ($anonymous_id != $_COOKIE['pwg_anonymous_rater']) 65 { // client has changed his IP adress or he's trying to fool us 61 $save_anonymous_id = pwg_get_cookie_var('anonymous_rater', $anonymous_id); 62 63 if ($anonymous_id != $save_anonymous_id) 64 { // client has changed his IP adress or he's trying to fool us 65 $query = ' 66 SELECT element_id 67 FROM '.RATE_TABLE.' 68 WHERE user_id = '.$user['id'].' 69 AND anonymous_id = \''.$anonymous_id.'\' 70 ;'; 71 $already_there = array_from_query($query, 'element_id'); 72 73 if (count($already_there) > 0) 74 { 66 75 $query = ' 67 SELECT element_id68 FROM '.RATE_TABLE.'69 WHERE user_id = '.$user['id'].'70 AND anonymous_id = \''.$anonymous_id.'\'71 ;';72 $already_there = array_from_query($query, 'element_id');73 74 if (count($already_there) > 0)75 {76 $query = '77 76 DELETE 78 FROM '.RATE_TABLE.' 79 WHERE user_id = '.$user['id'].' 80 AND anonymous_id = \''.$_COOKIE['pwg_anonymous_rater'].'\' 81 AND element_id NOT IN ('.implode(',', $already_there).') 82 ;'; 83 pwg_query($query); 84 } 85 86 $query = ' 87 UPDATE 88 '.RATE_TABLE.' 89 SET anonymous_id = \'' .$anonymous_id.'\' 90 WHERE user_id = '.$user['id'].' 91 AND anonymous_id = \'' . $_COOKIE['pwg_anonymous_rater'].'\' 77 FROM '.RATE_TABLE.' 78 WHERE user_id = '.$user['id'].' 79 AND anonymous_id = \''.$save_anonymous_id.'\' 80 AND element_id NOT IN ('.implode(',', $already_there).') 92 81 ;'; 93 82 pwg_query($query); 83 } 94 84 95 setcookie( 96 'pwg_anonymous_rater', 97 $anonymous_id, 98 strtotime('+10 years'), 99 cookie_path() 100 ); 101 } // end client changed ip 102 } // end client has cookie 103 else 104 { 105 setcookie( 106 'pwg_anonymous_rater', 107 $anonymous_id, 108 strtotime('+10 years'), 109 cookie_path() 110 ); 111 } 85 $query = ' 86 UPDATE 87 '.RATE_TABLE.' 88 SET anonymous_id = \'' .$anonymous_id.'\' 89 WHERE user_id = '.$user['id'].' 90 AND anonymous_id = \'' . $save_anonymous_id.'\' 91 ;'; 92 pwg_query($query); 93 } // end client changed ip 94 95 pwg_get_cookie_var('anonymous_rater', $anonymous_id); 112 96 } // end anonymous user 97 113 98 $query = ' 114 99 DELETE
Note: See TracChangeset
for help on using the changeset viewer.