[SCRIPT] Список кланов с айди

Тема в разделе "Веб скрипты (WEB)", создана пользователем root, 1 окт 2014.

  1. root

    root Administrator Команда форума Administrator Moderator Developers Team

    Регистрация:
    23 авг 2014
    Сообщения:
    254
    Симпатии:
    58
    Баллы:
    11
    Код:
    <?php  $mssql_addr="127.0.0.1";  
    $mssql_server="127.0.0.1";  
    $mssql_user="sa";  
    $mssql_pass="ggggggggggggggggg";  
    $mssql_db="lin2world";  
    
    
    mssql_connect($mssql_server,$mssql_user,$mssql_pass);  
    mssql_select_db($mssql_db);  
    
    
    $result = mssql_query("  
        SELECT  
            *  
        FROM  
            pledge as a left  
        JOIN user_data as b on a.ruler_id = b.char_id  
        ORDER BY  
            a.skill_level DESC");  
    
    
    $online_users=array();  
    for($x=0;($online_users[$x]=mssql_fetch_assoc($result));$x++)  
    {  
    
    
    }  
    
    
    unset($online_users[count($online_users)-1]);  
    
    
    
    
    for($x=0;$x<count($online_users);$x++)  
    {  
        $result = mssql_query("  
            SELECT  
                pledge_id, lev  
            FROM  
                user_data  
            WHERE  
                pledge_id = ".$online_users[$x]['pledge_id']  
        );  
    
    
        $member_count = mssql_num_rows($result);  
        $s=0;  
    
    
        for($i=0; $s1 = mssql_fetch_assoc($result); $i++)  
        {  
            $s=$s+$s1["lev"];  
        }  
    
    
        $online_users[$x]["membercount"]=$member_count;  
        $online_users[$x]["avglevel"]=round($s*10/$member_count)/10;  
    }  
    
    
    
    
    function avglevelsort($clanlist)  
    {  
        for ($i=0; $i < count($clanlist); $i++)  
        {  
            for ($j = count($clanlist)-1; $j > $i; $j--)  
            {  
                if (($clanlist[$j-1]["avglevel"]<$clanlist[$j]["avglevel"]) && ($clanlist[$j-1]["skill_level"]<=$clanlist[$j]["skill_level"]))  
                {  
                    $a=$clanlist[$j-1];  
                    $clanlist[$j-1]=$clanlist[$j];  
                    $clanlist[$j]=$a;  
                }  
            }  
        }  
    
    
        return $clanlist;  
    }  
    
    
    function avglevelsort1($clanlist)  
    {  
        for ($i=0; $i < count($clanlist); $i++)  
        {  
            $a=$clanlist[$i];  
            $j=$i-1;  
    
    
            while ($a < $clanlist[$j])  
            {  
                $clanlist[$j+1]=$clanlist[$j];  
                $j--;  
    
    
                if ($j<0) break;  
            }  
    
    
            $clanlist[$j+1]=$a;  
        }  
    
    
        return $clanlist;  
    }  
    
    
    $online_users=avglevelsort($online_users);  
    ?>  
    <thead>  
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">  
        <table width="100%" border="0" cellspacing="0" cellpadding="0">  
        <script type="text/javascript" language="JavaScript1.2" src=http://anonymouse.org/cgi-bin/anon-www.cgi/http://forum.la2man.ru/"sort.js"></script>  
    </thead>  
    
    
    <table>  
    <tr>  
    <td class="border-tl">&nbsp;</td>  
    <td class="border-t h-cell t-bold">Рейтинг кланов</td>  
    <td class="border-tr">&nbsp;</td>  
    </tr>  
    <tr>  
    <td class="border-l">&nbsp;</td>  
    <td class="n-cell"><table width="100%" border="0" cellspacing=0 class="sort" sellpadding=0>  
    <tbody>  
    <tr>  
        <td width="30" class="c-header">№</td>  
        <td width="16" class="c-header"><br></td>  
        <td class="c-header">ID clana</td>  
        <td class="c-header">Название</td>  
        <td width="80" class="c-header">Уровень</td>  
        <td class="c-header">Лидер</td>  
        <td width="120" class="c-header">Кол-во членов</td>  
        <td width="120" class="c-header">очки</td>  
    </tr>  
    <?  
    $y=0;  
    for ($x=0; $x < count($online_users); $x++)  
    {  
        if ($online_users[$x]["membercount"]==1) continue;  
    ?>  
    <tr>  
    <td><b><?=$y+1?></b></td>  
    <?If ($online_users[$x]["pledge_crest_id"]<>0)  
    echo '<td><b></b></td>';  
    else  
    echo '<td><br></td>';  
    ?>  
    <td align="left"><b><?=$online_users[$x]["pledge_id"]?></b></td>  
    <td><b><?=$online_users[$x]["pledge_name"]?></b></td>  
    <td><b><?=$online_users[$x]["skill_level"]?></b></td>  
    <td><b><?=$online_users[$x]["char_name"]?></b></td>  
    <td><b><?=$online_users[$x]["membercount"]?></b></td>  
    <td><b><?=$online_users[$x]["score"]?></b></td>  
    </tr>  
    <?  
        $y++;  
    }  
    ?>  
    </tbody>  
    </table></td>  
    <td class="border-r">&nbsp;</td>  
    </tr>  
    </table></td>  
    </tr>  
    </table>  
    </td>