Changeset 811 for trunk/Modules/Referrer
- Timestamp:
- May 28, 2014, 11:00:26 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Referrer/Referrer.php
r805 r811 41 41 { 42 42 $IP = GetRemoteAddress(); 43 44 // Check if client IP is not bl ocked as spam source45 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ` Referrer` WHERE `LastIP` = "'.$IP.'" AND (`Visible` = 0)');43 44 // Check if client IP is not blaclisted as spam source. If yes then add new referrer as invisible 45 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `BlackList` WHERE `IP` = "'.$IP.'"'); 46 46 $DbRow = $DbResult->fetch_row(); 47 if($DbRow[0] == 0) $Visible = '1'; 48 else $Visible = '0'; 47 if($DbRow[0] == 0) 48 { 49 $Visible = '1'; 50 $Description = ''; 51 } else 52 { 53 $Visible = '0'; 54 $Description = 'Spam'; 55 } 49 56 50 57 // Check if host name is already stored and need just to update hit counter … … 55 62 $this->System->Database->query('UPDATE `Referrer` SET `Hits` = `Hits` + 1, `DateLast` = NOW(), `LastURL` = "'. 56 63 addslashes($Referrer).'", `LastIP` = "'.$IP.'" WHERE `Id` = '.$DbRow['Id']); 57 } else $this->System->Database->query('INSERT INTO `Referrer` (`Web`, `DateFirst`, `DateLast`, `LastURL`, `Hits`, `LastIP`, `Visible`) '. 58 'VALUES ("'.$HostName.'", NOW(), NOW( ), "'.addslashes($Referrer).'", 1, "'.$IP.'", '.$Visible.')'); 64 } else 65 { 66 $this->System->Database->query('INSERT INTO `Referrer` (`Web`, `DateFirst`, `DateLast`, `LastURL`, `Hits`, `LastIP`, `Visible`, `Description`) '. 67 'VALUES ("'.$HostName.'", NOW(), NOW( ), "'.addslashes($Referrer).'", 1, "'.$IP.'", '.$Visible.', "'.$Description.'")'); 68 } 59 69 } 60 70 } … … 177 187 $Item = $DbResult->fetch_assoc(); 178 188 $this->Database->update('Referrer', 'Id='.$_GET['id'], array('Visible' => 0, 'Description' => 'Spam')); 189 $DbResult2 = $this->Database->select('BlackList', '*', 'IP="'.$Item['LastIP'].'"'); 190 if($DbResult2->num_rows == 0) 191 { 192 $this->Database->insert('BlackList', array('Time' => 'NOW()', 'IP' => $Item['LastIP'])); 193 } 179 194 $Output = ShowMessage(T('Set as spam'), MESSAGE_CRITICAL); 180 195 $Output .= $this->ShowList();
Note:
See TracChangeset
for help on using the changeset viewer.