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

Размер файла: 1.79Kb
<?
require ('data/config.php');
require ('data/mysql.php');


if (!$id)
        {
       header("Location:$http_address");
        // вывод баннера если не правильно указан ID_site
        }
else
          {
           $date=time();$action="click";
        $ip=$REMOTE_ADDR;
        // $result89= mysql_query("SELECT * FROM stat WHERE id_account='$id' AND `action`='view' AND `ip`='$ip'");
        $result33= mysql_query("SELECT * FROM stat_acc where `action`='view' AND `ip`='$ip' ORDER BY `id` DESC ");
        $row33 = mysql_fetch_array($result33);
        $acc=$id;
        $idi=$row33[id_account];

           $ip=$REMOTE_ADDR;
        $result= mysql_query("SELECT * FROM stat_acc WHERE id_account='$idi' AND `action`='click' AND `ip`='$ip' ORDER BY `id` DESC ");           //     AND `date`

         $row = mysql_fetch_array($result);  $ipp=$REMOTE_ADDR;
         $dati=time()+60;

         //if($date-$row89[data]>5)
          //if($row89[data]+5>time()) //&& $row89[data]>time()-60
           //{
                  /* if($REMOTE_ADDR==$row[ip])
                   {     */

                     /*   $result89= mysql_query("SELECT * FROM stat WHERE id_account='$id' AND `action`='view' AND `ip`='$ip'");  */



        $result= mysql_query("INSERT INTO stat (id_account,date,action,ip) VALUES ('$acc','$date','$action','$ip')");
        $result= mysql_query("INSERT INTO stat_acc (id_account,date,action,ip) VALUES ('$idi','$date','$action','$ip')");

        $result= mysql_query("SELECT * FROM accounts WHERE id='$idi'") or die ("трабл");
        if (mysql_num_rows($result)==0) print $err_page;
        $row = mysql_fetch_array($result);

        header("Location:$row[url]");
        exit();
       /* } else  {  header("Location:$http_address");    }    */
        }
?>