Просмотр файла banners.ru/www/banner5.php

Размер файла: 9.08Kb
<?
require ('data/config.php');
require ('data/mysql.php');
  /*   $result45= mysql_query("SELECT * FROM `accounts` WHERE `id`='$id' AND `status`='1'");
        $row45 = mysql_fetch_array($result45);

 $oni4=$row45[onoff];
      $result9= mysql_query("UPDATE `view` SET `onoff`='$oni4' WHERE `id_account`='$id'");   */

if (!$id)
        {
          $im = imagecreatefromgif('images/bb.gif');  $sx = imagesx($im);   $sy = imagesy($im);    $img = imagecreate(68,30);    imageCopyResized($img, $im, 0, 0, 0, 0, 68, 30, $sx, $sy);   header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");   header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");    header("Cache-Control: no-store, no-cache, must-revalidate");    header("Cache-Control: post-check=0, pre-check=0", false);    header("Pragma: no-cache");    header("Content-type: image/gif");    imageGIF($img);    ImageDestroy($img);
        }
else
        {
        $date=time();$action="view";
        $ip=$REMOTE_ADDR;
        $result= mysql_query("SELECT * FROM `accounts` WHERE `id`='$id' AND `status`='1'");
        $row = mysql_fetch_array($result);

          $resultp= mysql_query("SELECT * FROM accounts WHERE id='".$id."' AND status='1'");
        $rowp = mysql_fetch_array($resultp);
          $onip=$rowp[onoff];
          if($onip=='2') { $tt=mysql_query("UPDATE view SET onoff='1' WHERE id_account='".$id."'");   }
          if($onip=='1') { $tt=mysql_query("UPDATE `view SET onoff='2' WHERE id_account='".$id."'");
          }
        if (mysql_num_rows($result)==0)
                {  $im = imagecreatefromgif('images/bb.gif');  $sx = imagesx($im);   $sy = imagesy($im);    $img = imagecreate(68,30);    imageCopyResized($img, $im, 0, 0, 0, 0, 68, 30, $sx, $sy);   header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");   header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");    header("Cache-Control: no-store, no-cache, must-revalidate");    header("Cache-Control: post-check=0, pre-check=0", false);    header("Pragma: no-cache");    header("Content-type: image/gif");    imageGIF($img);    ImageDestroy($img);  exit();}

                $resut= mysql_query("SELECT * FROM accounts WHERE id='$id'");
$row6t = mysql_fetch_array($resut);
 $onit=$row6t[onoff];
 if ($onit=='2')$pr_count = mysql_query("UPDATE view SET onoff='2'  WHERE id_account='$row6t[id]';");
       ////////////// if (!strstr($HTTP_REFERER,$row[host]))
           /* if ($HTTP_REFERER!=$row[host])
                {  $im = imagecreatefromgif('images/bb.gif');  $sx = imagesx($im);   $sy = imagesy($im);    $img = imagecreate(68,30);    imageCopyResized($img, $im, 0, 0, 0, 0, 68, 30, $sx, $sy);   header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");   header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");    header("Cache-Control: no-store, no-cache, must-revalidate");    header("Cache-Control: post-check=0, pre-check=0", false);    header("Pragma: no-cache");    header("Content-type: image/gif");    imageGIF($img);    ImageDestroy($img);  exit();}  */
         /* $resultk= mysql_query("SELECT * FROM `view` WHERE `id_account`<>'$id' ORDER BY rand() LIMIT 1;");
        $rowk = mysql_fetch_array($resultk);    */
        $result= mysql_query("SELECT * FROM view.id_account,banners.status WHERE (view.id_account<>'$id',banners.status='1' or view.id_account<>'$id',banners.status='2') and view.onoff='1',banners.onoff='1' ORDER BY rand() LIMIT 1;");
         $result= mysql_query("SELECT * FROM `view` WHERE `id_account`<>'$id' and `onoff`='1' ORDER BY rand() LIMIT 1;");
          $result= mysql_query("SELECT * FROM `view` WHERE `id_account`<>'$id' and `onoff`='1' ORDER BY rand() LIMIT 1;");
            $result= mysql_query("SELECT * FROM `view` WHERE `id_account`<>'$id' ORDER BY rand() LIMIT 1;");
        $row = mysql_fetch_array($result);


        $result2= mysql_query("SELECT * FROM `accounts` WHERE `id`='$row[id_account]' `onoff`='1' LIMIT 1");
         $result2= mysql_query("SELECT * FROM `accounts` WHERE `id`='$row[id_account]' LIMIT 1");                        
        $row2 = mysql_fetch_array($result2);
        if (mysql_num_rows($result2)==0)
                {  $im = imagecreatefromgif('images/bb.gif');  $sx = imagesx($im);   $sy = imagesy($im);    $img = imagecreate(68,30);    imageCopyResized($img, $im, 0, 0, 0, 0, 68, 30, $sx, $sy);   header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");   header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");    header("Cache-Control: no-store, no-cache, must-revalidate");    header("Cache-Control: post-check=0, pre-check=0", false);    header("Pragma: no-cache");    header("Content-type: image/gif");    imageGIF($img);    ImageDestroy($img); exit();}
          $result3= mysql_query("SELECT * FROM banners WHERE `id_account`='$row2[id]' AND `status`='2' AND `onoff`='1' LIMIT 1");
            $result3= mysql_query("SELECT * FROM banners WHERE `id_account`='$row2[id]' AND `status`='2' LIMIT 1");
        if (mysql_num_rows($result3)==0)
                {

                     $result4= mysql_query("UPDATE banners SET `status`='2' WHERE `id_account`='$row2[id]' AND `status`='1' AND `onoff`='1'");
                      $result4= mysql_query("UPDATE banners SET `status`='2' WHERE `id_account`='$row2[id]' AND `status`='1'");
                $result3= mysql_query("SELECT * FROM banners WHERE `id_account`='$row2[id]' AND `status`='2' AND `onoff`='1' LIMIT 1");
                $result3= mysql_query("SELECT * FROM banners WHERE `id_account`='$row2[id]' AND `status`='2' LIMIT 1");

                if (mysql_num_rows($result3)==0) {  $im = imagecreatefromgif('images/bb.gif');  $sx = imagesx($im);   $sy = imagesy($im);    $img = imagecreate(68,30);    imageCopyResized($img, $im, 0, 0, 0, 0, 68, 30, $sx, $sy);   header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");   header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");    header("Cache-Control: no-store, no-cache, must-revalidate");    header("Cache-Control: post-check=0, pre-check=0", false);    header("Pragma: no-cache");    header("Content-type: image/gif");    imageGIF($img);    ImageDestroy($img); exit();}
              }
        $row3 = mysql_fetch_array($result3);
        $result4= mysql_query("UPDATE banners SET `status`='1' WHERE `id`='$row3[id]' LIMIT 1");

         // $im = imagecreatefromgif($iii);
      /*  if ($row3[file_banner]=='')   {  $im = imagecreatefromgif('images/bb.gif');  $sx = imagesx($im);   $sy = imagesy($im);    $img = imagecreate(68,30);    imageCopyResized($img, $im, 0, 0, 0, 0, 68, 30, $sx, $sy);   header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");   header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");    header("Cache-Control: no-store, no-cache, must-revalidate");    header("Cache-Control: post-check=0, pre-check=0", false);    header("Pragma: no-cache");    header("Content-type: image/gif");    imageGIF($img);    ImageDestroy($img); exit();}   */
       $im = imagecreatefromgif('images/'.$row3[file_banner]);

   $sx = imagesx($im);
   $sy = imagesy($im);
if($row3[file_banner]=="22.gif")
   $iii='22.gif'; else $iii='images/'.$row3[file_banner];
   // $imi = imagecreatefromgif($iii);
   //$img=ImageGIF($imi);
   // $img=ImageGIF(imagecreatefromgif('images/'.$row3[file_banner]));
   $img = @imagecreate(95,35);
   imageCopyResized($img, $im, 0, 0, 0, 0, 95, 35, $sx, $sy);
   header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
   header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
   header("Cache-Control: no-store, no-cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", false);
   header("Pragma: no-cache");
   header("Content-type: image/gif");
   imageGIF($img);
   ImageDestroy($img);
        $result= mysql_query("INSERT INTO stat_acc (id_account,date,action,ip) VALUES ('$row2[id]','$date','$action','$ip')");
     //   $result= mysql_query("DELETE FROM view WHERE id_account='$row2[id]' LIMIT 1");
        $result= mysql_query("DELETE FROM view WHERE id_account='$row2[id]' LIMIT 1");
        $result2= mysql_query("SELECT * FROM komissia WHERE id_account='$id' LIMIT 1");
        $row2 = mysql_fetch_array($result2);
        if ($row2[view]<=9)
                {
                $result= mysql_query("UPDATE komissia SET view=view+1 WHERE id_account='$id'");
//                $result= mysql_query("INSERT INTO view (id_account) VALUES ('$id')");
 /*$result7= mysql_query("SELECT * FROM accounts WHERE `id`='$id' limit 1;");
        $row7 = mysql_fetch_array($result7);
        $oni=$row7[onoff];    */
                  $result45= mysql_query("SELECT * FROM `accounts` WHERE `id`='$id' AND `status`='1'");
        $row45 = mysql_fetch_array($result45);
         $result64= mysql_query("SELECT * FROM accounts WHERE id='$id'");
$row64 = mysql_fetch_array($result64);
 $oni4=$row45[11];
       // if($row7[onoff]=='2') {$result9= mysql_query("UPDATE `view` SET `onoff`='2' WHERE `onoff`='1' and `id_account`='$id'");}
  $result= mysql_query("INSERT INTO `view` (id_account,onoff) VALUES ('$id','$oni4')");
                }
        else
                {
                $result= mysql_query("UPDATE komissia SET view='0' WHERE id_account='$id'");
                }
        $result= mysql_query("INSERT INTO stat (id_account,date,action,ip) VALUES ('$id','$date','$action','$ip')");
        }

?>