Changeset 185


Ignore:
Timestamp:
Apr 22, 2009, 10:58:57 AM (16 years ago)
Author:
george
Message:
  • Upraveno: Lepší filtrování vkládání adres odkazů na banner a záznam plného posledního URL z dané domény.
Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/banners.php

    r67 r185  
    55ShowPage();
    66 
    7 $ID = $Database->SQLCommand("SELECT * FROM `banner` WHERE `Show`=1 AND `DateLast` > (NOW() - INTERVAL 3 MONTH)");
     7$ID = $Database->SQLCommand('SELECT * FROM `banner` WHERE `Show`=1 AND `DateLast` > (NOW() - INTERVAL 3 MONTH)');
    88 
    99echo('<strong>Servery odkazující na nás:</strong> <br />
    1010<div style="font-size: 10px;">Seznam je automaticky aktualizován a zobrazeny jsou servery s aktivní bannerem mladším než tři měsíce.</div><br />');
    11 while($Line = mysql_fetch_array($ID))
     11while($Line = mysql_fetch_assoc($ID))
    1212{
    13   echo('<a href="'.$Line['Web'].'">'.$Line['Web'].'</a> '.$Line['Description'].' <br />');     
     13  echo('<a href="'.$Line['Web'].'">'.$Line['LastURL'].'</a> '.$Line['Description'].' <br />');         
    1414}
    1515 
  • trunk/banners/banner.php

    r67 r185  
    66$Referer = addslashes($_SERVER['HTTP_REFERER']);
    77$Referer = substr($Referer, strpos($Referer, '/') + 2);
    8 $Referer = 'http://'.substr($Referer, 0, strpos($Referer, '/')).'/';
    9 $DbResult = mysql_query('SELECT * FROM `banner` WHERE `Web` = "'.$Referer.'"', $Database->id_connection);
    10 if(mysql_num_rows($DbResult) > 0)
    11   $Database->SQLCommand('UPDATE `banner` SET `DateLast` = NOW() WHERE `Web` = "'.$Referer.'"');
    12   else mysql_query('INSERT INTO `banner` (`Web`, `DateFirst`, `DateLast`) VALUES ("'.$Referer.'", NOW(), NOW( ))', $Database->id_connection);
     8$HostName = substr($Referer, 0, strpos($Referer, '/'));
     9if(substr($HostName, -1) == '.') $HostName = substr($HostName, 0, -1);
     10if($HostName != gethostbyname($HostName))
     11{
     12  $Referer = 'http://'.$HostName.'/';
     13  $DbResult = mysql_query('SELECT * FROM `banner` WHERE `Web` = "'.$Referer.'"', $Database->id_connection);
     14  if(mysql_num_rows($DbResult) > 0)
     15    $Database->SQLCommand('UPDATE `banner` SET `DateLast` = NOW(), `LastURL` = "'.addslashes($_SERVER['HTTP_REFERER']).'" WHERE `Web` = "'.$Referer.'"');
     16    else mysql_query('INSERT INTO `banner` (`Web`, `DateFirst`, `DateLast`, LastURL`) VALUES ("'.$Referer.'", NOW(), NOW( ), "'.addslashes($_SERVER['HTTP_REFERER']).'")', $Database->id_connection);
     17}
     18
    1319$Image = imagecreatefromjpeg(addslashes($_GET['image']));
    1420imagepng($Image);
Note: See TracChangeset for help on using the changeset viewer.