Вход Регистрация
Файл: pages/rewrite_in.php
Строк: 52
<?php # Created by Up

include_once '../sistem/start.php';
include_once 
$config['OTS'].'sistem/config.php';
//include_once $config['OTS'].'sistem/function.php';
include_once $config['OTS'].'sistem/db.php';
//include_once $config['OTS'].'sistem/users.php';

$go_url=$config['home'].'/?act=error&error=404';

if(isset(
$_GET['id']))
 {
    
$id=((int)abs($_GET['id']));
    if(
mysql_num_rows($sql=mysql_query('SELECT * FROM `site` where `id`=''.$id.'' LIMIT 1;'))>=1)
     {
        
$go_url=$config['home'].'/site/'.$id.'/index.php';
        
$arr=mysql_fetch_assoc($sql);
        if(!isset(
$_SESSION['go_top_'.$id]) and !isset($_COOKIE['go_top_'.$id]))
         {
            
$db='';
            
$_ip=ip2long($_SERVER['REMOTE_ADDR']);
            if(isset(
$_SERVER['HTTP_X_FORWARDED_FOR']) && $count_ip=ip2long($_SERVER['HTTP_X_FORWARDED_FOR'])==0)
                if(isset(
$_SERVER['HTTP_VIA']) && $count_ip=ip2long($_SERVER['HTTP_VIA'])==0)
                    if(isset(
$_SERVER['HTTP_CLIENT_IP']) && $count_ip=ip2long($_SERVER['HTTP_CLIENT_IP'])==0)
                        if(isset(
$_COOKIE['CLIENT_IP']) && $count_ip=ip2long($_COOKIE['CLIENT_IP'])==0)
                            
SetCookie('CLIENT_IP',$_SERVER['REMOTE_ADDR'],time()+60*60*24);
            
$IP_SQL='`ip`=''.$_ip.'' or `via`=''.$_ip.''';
            if(
$count_ip!=0)
                
$IP_SQL.=' or `ip`=''.$count_ip.'' or `via`=''.$count_ip.''';
            if(
mysql_num_rows($sql=mysql_query('SELECT * FROM `statistic` WHERE `for`=''.$id.'' and ('.$IP_SQL.') LIMIT 1;'))>=1)
             {
                
$array=mysql_fetch_assoc($sql);
                if(
$array['go_kredit']==1)
                 {
                    
$rand=mysql_num_rows($sql=mysql_query('SELECT `id`,`url` FROM `site` WHERE `id`!=''.$id.'' AND `kredit`>='1';'));
                    if(
$rand>=1)
                     {
                        
$db='`kredit`=''.($arr['kredit']+1).'',';
                        
mysql_unbuffered_query('UPDATE `statistic` SET `go_kredit`='2' WHERE `for`=''.$id.'' and `ip`=''.$array['ip'].'' and `via`=''.$array['via'].'' LIMIT 1;');
                        
$rand=rand(0,($rand-1));
                        
$go_url='http://'.mysql_result($sql,$rand,'url');
                        
mysql_unbuffered_query('UPDATE `site` SET `kredit`=(`kredit`-1),`s_top`=(`s_top`+1),`vsego_s_top`=(`vsego_s_top`+1) WHERE `id`=''.mysql_result($sql,$rand,'id').'' LIMIT 1;');
                     }
                 }
             }
            
$_SESSION['go_top_'.$id]=1;
            
SetCookie('go_top_'.$id,1,time()+60*60*24);
            
mysql_unbuffered_query('UPDATE `site` SET '.$db.'`v_top`=''.($arr['v_top']+1).'',`vsego_v_top`=''.($arr['vsego_v_top']+1).'' WHERE `id`=''.$id.'' LIMIT 1;');
         }
     }
 }


header('location: '.$go_url);
exit;

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