Changeset 297 for quests/banners/baner_88_31.php
- Timestamp:
- Feb 8, 2008, 11:08:10 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quests/banners/baner_88_31.php
r295 r297 4 4 include('../includes/databaseconection.php'); 5 5 6 7 6 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']); 8 7 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); 9 8 $Database->SelectDatabase($Config['Database']['Database']); 10 9 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 11 42 $img = imagecreatefromjpeg('baner_88_31.jpg'); 12 43 $address = @$_SERVER["HTTP_REFERER"]; 44 $ArrayWebIP = GetArrayWebs(); 45 46 if (HaveInArray($ArrayWebIP,GetIP($address)) == false) { 47 $CanWrite = true; 48 } else { 49 $CanWrite = false; 50 } 13 51 14 52 $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM banner WHERE Web = '$address'")); 15 if ( !$Line) {53 if ((!$Line) and $CanWrite) { 16 54 $Database->SQLCommand("INSERT INTO `banner` ( `Date` , `Web` ) VALUES ( NOW() , '$address');"); 17 55 } … … 21 59 // imagestring($img, 10, 10, 30, 'Pøispupujete z: '.$address, $Color3); 22 60 61 // Header('Content-Disposition: attachment; filename="img_468_60.jpg"'); 23 62 header('Content-Type: image/png'); 24 // Header('Content-Disposition: attachment; filename="img_468_60.jpg"');25 63 imagepng($img); 26 64
Note:
See TracChangeset
for help on using the changeset viewer.