Вход Регистрация
Файл: public_html/autoref.php
Строк: 22
<?
function getreferer()
{
    
$res=mysql_query("select count(id) as kolvo from tb_users where autoref='1'");
    
$res=mysql_fetch_array($res);
    if(
$res["kolvo"]<1)
    {
        return 
'';
    }else{
        
$res=mysql_query("select username from tb_users where autoref='1'");
        
        
$row=mysql_fetch_array($res);
        
$minuser=$row["username"];
        
$res1=mysql_query("select count(id) as rkol from tb_users where referer='$minuser' and buying='2'");
        
$res1=mysql_fetch_array($res1);
        
$minrefs=$res1["rkol"];

        while(
$row=mysql_fetch_array($res))
        {
            
$user=$row["username"];
            
$res1=mysql_query("select count(id) as rkol from tb_users where referer='$user' and buying='2'");
            
$res1=mysql_fetch_array($res1);
            if(
$res1["rkol"]<$minrefs)
            {
                
$minuser=$user;
                
$minrefs=$res1["rkol"];
            }
        }

        return 
$minuser;
    }
}
?>
Онлайн: 3
Реклама