Changeset 297


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

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

Location:
quests
Files:
1 added
4 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
  • quests/banners/baner_88_31.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_88_31.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
  • quests/includes/global.php

    r295 r297  
    7272      <a Title="Hlavní stránka" href="index.php">Domù</a><br />
    7373      <a Title="Diskuze na téma pøeklárání" href="http://wow.zdechov.net/forum/viewforum.php?f=22">Forum projektu</a><br />
    74       <a Title="Domácí server" href="http://wow.zdechov.net/">Web serveru</a><br />
     74      <a Title="Weby odkazující na tento projekt bennerem" href="banners.php">Odkazuje na nás</a><br />
    7575      <a Title="Slovník wow výrazù" onclick="javascript:window.open(\'dictionary.php\',\'Slovník\',\'width=400,height=412\'); return false;" href="dictionary.php">Slovníèek</a><br />
    7676      <a Title="Statistika pøekládání" href="statistic.php">Statistika</a><br />
  • quests/structure/banner.sql

    r295 r297  
     1- phpMyAdmin SQL Dump
     2-- version 2.9.1.1
     3-- http://www.phpmyadmin.net
     4--
     5-- Host: localhost
     6-- Generation Time: Feb 08, 2008 at 11:09 PM
     7-- Server version: 5.0.27
     8-- PHP Version: 5.2.0
     9--
     10-- Database: `quests`
     11--
    112
     13-- --------------------------------------------------------
    214
     15--
     16-- Table structure for table `banner`
     17--
    318
    419CREATE TABLE `banner` (
    5 `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    6 `Date` DATETIME NOT NULL ,
    7 `Web` TEXT NOT NULL
    8 ) ENGINE = MYISAM ;
     20  `ID` int(11) NOT NULL auto_increment,
     21  `Date` datetime NOT NULL,
     22  `Web` text NOT NULL,
     23  `Show` int(11) NOT NULL default '1',
     24  `Description` text NOT NULL,
     25  PRIMARY KEY  (`ID`),
     26  KEY `Show` (`Show`)
     27) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=55 ;
     28
     29/*
     30ALTER TABLE `banner` ADD `Show` INT NOT NULL DEFAULT '1',
     31ADD `Description` TEXT NOT NULL ;
     32
     33ALTER TABLE `banner` ADD INDEX ( `Show` ) ;
     34*/
Note: See TracChangeset for help on using the changeset viewer.