Вход Регистрация
Файл: __system/pages/in.php
Строк: 56
<?



    $site 
$db -> query
                            
("

                             SELECT * FROM `site` WHERE `id` = '"
.filtration::int($_GET['id'])."' LIMIT 1

                            "
);

        if(
$site -> rowCount() == 1)
        {
          
$s $site -> fetch(PDO::FETCH_ASSOC);

          
$site_h $db->exec("UPDATE `site` SET  `allIn` = (`allIn` + '1') WHERE `id` = '".$s['id']."' ");

          
$site_statistic_h $db->exec("UPDATE `site_statistic` SET   `in` = (`in` + '1')
                WHERE `siteID` = '"
.$s['id']."' and `date` = '".date("Y-m-d",time())."' ");



            if (isset(
$_SERVER['HTTP_X_FORWARDED_FOR']) and preg_match('|^d{1,3}.d{1,3}.d{1,3}.d{1,3}$|',$_SERVER['HTTP_X_FORWARDED_FOR'])){
            
$ip trim(htmlspecialchars($_SERVER['HTTP_X_FORWARDED_FOR']));
            }elseif(isset(
$_SERVER['HTTP_CLIENT_IP']) and preg_match('|^d{1,3}.d{1,3}.d{1,3}.d{1,3}$|',$_SERVER['HTTP_CLIENT_IP'])){
            
$ip trim(htmlspecialchars($_SERVER['HTTP_CLIENT_IP']));
            }elseif(isset(
$_SERVER['REMOTE_ADDR']) and preg_match('|^d{1,3}.d{1,3}.d{1,3}.d{1,3}$|',$_SERVER['REMOTE_ADDR'])){
            
$ip trim(htmlspecialchars($_SERVER['REMOTE_ADDR']));
            }else{
            
$ip 'Скрыт';
            }


            if (isset(
$_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])){
            
$ua trim(htmlspecialchars($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']));
            }elseif (isset(
$_SERVER['HTTP_USER_AGENT'])){
            
$ua trim(htmlspecialchars($_SERVER['HTTP_USER_AGENT']));
            }else{
            
$ua 'Скрыт';
            }

            
$ua strtok($ua'/');
            
$ua strtok($ua' ');

            if (
preg_match('/opera min/i'$ua)) $browser 'Opera Mini';
            else if (
preg_match('/Chrome/i'$ua))$browser 'Chrome';
            else if (
preg_match('/Opera/i'$ua)) $browser 'Opera';
            else if (
preg_match('/MSIE/i'$ua)) $browser 'IE';
            else if (
preg_match('/Mozilla/i'$ua)) $browser 'Mozilla';
            else if (
preg_match('/ucweb/i'$ua)) $browser 'UCWeb';
            else 
$browser 'Неизвестно';


          
$ip_isset $db -> query
                            
("

                             SELECT `id` FROM `note_host_in` WHERE `siteID` = '"
.$s['id']."' AND `ip` = '".$ip."' and `date`='".date("Y-m-d",time())."'

                            "
);





            if ((
$ip_isset -> rowCount()) == 0)

              {


                
$operator $db -> query
                            
("

                             SELECT `on` FROM `ip` WHERE INET_ATON('"
.$ip."') BETWEEN `min` AND `max`

                            "
);

                if(
$operator -> rowCount() > 0)

                  {
                     
$o $operator -> fetch(PDO::FETCH_ASSOC);
                     
$operator_note $o['on'];
                  }

                    else

                  {
                    
$operator_note 1000;
                  }



                
$stmt $db->prepare("INSERT INTO `note_host_in` (`id`,`siteID`,`ip`,`browser`,`operator`,`date`,`time`) VALUES (?,?,?,?,?,?,?)");
                
$stmt -> execute(array('',''.$s['id'].'',''.$ip.'',''.$browser.'',''.$operator_note.'',''.date("Y-m-d",time()).'',''.time().''));

                
$money 0.05;
                
$userUpdate $db->prepare("UPDATE `users` SET `money` =  (`money` + :money) WHERE `id` = :id LIMIT 1");
                
$userUpdate->bindParam(':money'$money);
                
$userUpdate->bindParam(':id'$s['userID']);
                
$userUpdate->execute();


              }






          
$top100 $db -> query
                            
("

                             SELECT * FROM site,site_statistic WHERE site.status = '1' and  site.blocked = '0'  and  site.id = site_statistic.siteID
                             and  site_statistic.date = '"
.date("Y-m-d",time())."'  and site_statistic.host > '0'
                              ORDER BY site_statistic.host DESC  LIMIT 100

                            "
);

          
$start_limit 0;
            while(
$t $top100 -> fetch(PDO::FETCH_ASSOC))

            {

             if(
$s['id'] == $t['id'])
             {

                
$page round($start_limit 10 0.5);
                
header('Location: /index/'.$page.'/'.$s['id'].'/');  exit;

             }
             
$start_limit++;
            }



          
$site_page $db -> query
                            
("

                             SELECT * FROM site,site_statistic WHERE site.status = '1' and  site.blocked = '0'  and  site.id = site_statistic.siteID
                             and  site_statistic.date = '"
.date("Y-m-d",time())."'  and site_statistic.host > '0' and site.category = '".filtration::int($s['category'])."'
                              ORDER BY site_statistic.host DESC

                            "
);

           
$start_limit 0;
            while(
$sp $site_page -> fetch(PDO::FETCH_ASSOC))

            {

             if(
$s['id'] == $sp['id'])
             {
               
$page round($start_limit 10 0.5);
               if(
$page 0)
               {
                 
header('Location: /sitelist/'.$s['category'].'/'.$page.'/'.$s['id'].'/');  exit;
               }

                 else

               {                 
header('Location: /sitelist/'.$s['category'].'/'.$page.'/'.$s['id'].'/'); exit;
               }


             }
             
$start_limit++;
            }



            
header('Location: /index/'); exit;





        }

          else

        {

           
header('Location: /index/'); exit;

        }












?>
Онлайн: 2
Реклама