Ignore:
Timestamp:
Feb 8, 2008, 11:08:10 PM (17 years ago)
Author:
maron
Message:

Zobrazení serverů odkazující na nás, filtr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quests/banners/baner_468_60.php

    r295 r297  
    44  include('../includes/databaseconection.php');
    55
    6 
    76  $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
    87  $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
    98  $Database->SelectDatabase($Config['Database']['Database']);   
    109
     10  function HaveInArray($Array,$String)
     11  { // BEGIN function HaveInArray
     12    for ( $i = 0; $i < count($Array); ++$i) {
     13      if ($String == $Array[$i]) {
     14        return true;
     15      }
     16    }   
     17  } // END function HaveInArray
     18 
     19  function GetIP($Web)
     20  { // BEGIN function GetIP
     21    $result_string = substr($Web,0,strpos($Web,'/'));   
     22    $Web = substr($Web,strlen($result_string)+1,strlen($Web)-strlen($result_string)); 
     23    $result_string1 = substr($Web,0,strpos($Web,'/'));   
     24    $Web = substr($Web,strlen($result_string1)+1,strlen($Web)-strlen($result_string1)); 
     25    $result_string2 = substr($Web,0,strpos($Web,'/'));   
     26    $Web = substr($Web,strlen($result_string2)+1,strlen($Web)-strlen($result_string2)); 
     27    return $result_string2;     
     28  } // END function GetIP
     29 
     30  function GetArrayWebs()
     31  { // BEGIN function GetArrayWebs
     32    global $Database;
     33    $ID = $Database->SQLCommand("SELECT * FROM `banner`");
     34    $i = 0;
     35    while($Line = mysql_fetch_array($ID)) {
     36      $result[$i] = GetIP($Line['Web']);
     37      ++$i;
     38        }
     39        return $result;
     40  } // END function GetArrayWebs
     41
    1142  $img = imagecreatefromjpeg('baner_468_60.jpg');
    1243  $address = @$_SERVER["HTTP_REFERER"];
     44  $ArrayWebIP = GetArrayWebs();
     45
     46    if (HaveInArray($ArrayWebIP,GetIP($address)) == false) {
     47      $CanWrite = true;
     48    } else {
     49      $CanWrite = false;
     50    }
    1351
    1452  $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM banner WHERE Web = '$address'"));
    15   if (!$Line) {
     53  if ((!$Line) and $CanWrite) {
    1654    $Database->SQLCommand("INSERT INTO `banner` ( `Date` , `Web` ) VALUES ( NOW() , '$address');");
    1755  }
     
    2159 // imagestring($img, 10, 10, 30, 'Pøispupujete z: '.$address, $Color3);
    2260
     61//  Header('Content-Disposition: attachment; filename="img_468_60.jpg"');
    2362  header('Content-Type: image/png');
    24 //  Header('Content-Disposition: attachment; filename="img_468_60.jpg"');
    2563  imagepng($img);
    2664
Note: See TracChangeset for help on using the changeset viewer.