Changeset 374 for minimanager/index.php


Ignore:
Timestamp:
Sep 11, 2008, 9:10:27 AM (16 years ago)
Author:
george
Message:
  • Aktualizováno: Minimanager 0.12 rev. 99. Opraveno zobrazování honoru, přidána captcha p?i registraci nového účtu a mini fórum.
  • Přidáno: Český překlad pro Minimanager 0.12.
  • Smazáno: Staré fotky fyzického serveru přesunuty do fotogalerie.
  • Přidáno: Nějaké návody na eventy od bbtrashe.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • minimanager/index.php

    r307 r374  
    1616
    1717$sql = new SQL;
    18 
    1918$sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    2019
    2120$output .= "<div class=\"top\">";
    22 if (test_port($server[$realm_id]['addr'],$server[$realm_id]['game_port'])) {
    23 
    24 
    25 /*      $query = $sql->query("SELECT uptime FROM uptime ORDER BY starttime DESC LIMIT 1");
    26 *       $uptime = $sql->result($query, 0);
    27 *       $output .= "<h1><font color=\"#55aa55\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['online']} : (".(int)($uptime/60/60/24)."D : ".(($uptime/60/60 >= 24 )?(int)($uptime/60/60-24*(int)($uptime/60/60/24)):(int)($uptime/60/60))."H : ".(($uptime/60 >= 60 )?(int)($uptime/60-60*(int)($uptime/60/60)):(int)($uptime/60))."M : ".(($uptime >= 60 )?(int)($uptime-60*(int)($uptime/60)):(int)$uptime)."S)</font></h1>";
    28 */
     21
     22if (test_port($server[$realm_id]['addr'],$server[$realm_id]['game_port']))
     23{
    2924    $query = $sql->query("SELECT `starttime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1");
    3025    $getuptime = mysql_fetch_row($query);
    31 $uptimetime = time() - $getuptime[0];
    32     $uptime = array(
    33     'd' => $uptimetime / 86400 % 7,
    34     'h' => $uptimetime / 3600 % 24,
    35     'm' => $uptimetime / 60 % 60,
    36     's' => $uptimetime / 1 % 60,
    37      );
    38 if ($uptime[d] < 2) {
    39 $sd = ""; }
    40 else {
    41 $sd = "s"; }
    42 
    43 if ($uptime[h] < 2) {
    44 $sh = ""; }
    45 else {
    46 $sh = "s"; }
    47 
    48 if ($uptime[m] < 2) {
    49 $sm = ""; }
    50 else {
    51 $sm = "s"; }
    52 
    53 if ($uptime[s] < 2) {
    54 $ss = ""; }
    55 else {
    56 $ss = "s"; }
    57 
    58 if ($uptime[d] > 0) {
    59     $output .= "<h1><font color=\"#55aa55\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['online']} for " . $uptime[d] . " day$sd " .  $uptime[h] . " hour$sh " .  $uptime[m] . " minute$sm and  " .  $uptime[s] . " second$ss.</font></h1>";
    60     } else {
    61         if ($uptime[h] > 0) {
    62                 $output .= "<h1><font color=\"#55aa55\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['online']} for " .  $uptime[h] . " hour$sh " .  $uptime[m] . " minute$sm and  " .  $uptime[s] . " second$ss.</font></h1>";
    63                 } else {
    64                 $output .= "<h1><font color=\"#55aa55\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['online']} for " .  $uptime[m] . " minute$sm and  " .  $uptime[s] . " second$ss.</font></h1>";
    65                 }
    66         }
    67 
    68         $online = true;
    69         } else {
    70                 $output .= "<h1><font class=\"error\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['offline_or_let_high']}</font></h1>";
    71                 $online = false;
    72                 }
    73 /*$output .= "Mangos: {$server[$realm_id]['rev']} Using DB: {$mangos_db[$realm_id]['db_rev']}</div>";*/
    74         //  This retrieves the actual database version from the database itself,  instead of hardcoding it into a string
    75         $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    76         $query_db_version = $sql->query("SELECT version FROM db_version");
    77         $db_rev = $sql->result($query_db_version, 0);
     26    $uptimetime = time() - $getuptime[0];
     27    $uptime = array
     28        (
     29            'd' => $uptimetime / 86400 % 7,
     30            'h' => $uptimetime / 3600 % 24,
     31            'm' => $uptimetime / 60 % 60,
     32            's' => $uptimetime / 1 % 60,
     33         );
     34
     35    if ($uptime['d'] < 2) $sd = ""; else $sd = "s";
     36    if ($uptime['h'] < 2) $sh = ""; else $sh = "s";
     37    if ($uptime['m'] < 2) $sm = ""; else $sm = "s";
     38    if ($uptime['s'] < 2) $ss = ""; else $ss = "s";
     39
     40    if ($uptime['d'] > 0)
     41        $output .= "<h1><font color=\"#55aa55\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['online']} for " . $uptime['d'] . " day$sd " .  $uptime['h'] . " hour$sh " .  $uptime['m'] . " minute$sm and  " .  $uptime['s'] . " second$ss.</font></h1>";
     42    else
     43    {
     44        if ($uptime['h'] > 0)
     45            $output .= "<h1><font color=\"#55aa55\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['online']} for " .  $uptime['h'] . " hour$sh " .  $uptime['m'] . " minute$sm and  " .  $uptime['s'] . " second$ss.</font></h1>";
     46        else
     47            $output .= "<h1><font color=\"#55aa55\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['online']} for " .  $uptime['m'] . " minute$sm and  " .  $uptime['s'] . " second$ss.</font></h1>";
     48    }
     49
     50    $online = true;
     51}
     52else
     53{
     54    $output .= "<h1><font class=\"error\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['offline_or_let_high']}</font></h1>";
     55        $online = false;
     56}
     57
     58//  This retrieves the actual database version from the database itself,  instead of hardcoding it into a string
     59$sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     60$query_db_version = $sql->query("SELECT version FROM db_version");
     61$db_rev = $sql->result($query_db_version, 0);
    7862$output .= "Mangos: {$server[$realm_id]['rev']} Using DB: $db_rev</div>";
    79 
    8063$sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']);
    8164$sql->db($characters_db[$realm_id]['name']);
     
    9780                        <th align=\"right\">";
    9881if ($user_lvl) $output .= "<a href=\"motd.php?action=add_motd\">{$lang_index['add_motd']}</a>";
    99 $output .= "</td></tr>";
    100 if($all_record){
     82$output .= "</tr>";
     83
     84if($all_record)
     85{
    10186        $result = $sql->query("SELECT id, type, content FROM bugreport ORDER BY id DESC LIMIT $start, 3");
    10287        while($post = $sql->fetch_row($result)){
     
    11499
    115100//print online chars
    116 if ($online){
     101if ($online)
     102{
    117103        $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "name";
    118104
     
    123109        $result = $sql->query("SELECT count(*) FROM `characters` WHERE `online`= 1");
    124110        $total_online = $sql->result($result, 0);
    125 
    126         if( !$user_lvl && !$server[$realm_id]['both_factions']){
     111   
     112    $order_side = "";
     113        if( !$user_lvl && !$server[$realm_id]['both_factions'])
     114    {
    127115                $result = $sql->query("SELECT race FROM `characters` WHERE account = '$user_id' AND totaltime = (SELECT MAX(totaltime) FROM `characters` WHERE account = '$user_id') LIMIT 1");
    128                 if ($sql->num_rows($result)){
     116                if ($sql->num_rows($result))
     117        {
    129118                        $order_side = (in_array($sql->result($result, 0, 'race'),array(2,5,6,8,10))) ?
    130119                        " AND race IN (2,5,6,8,10) " : " AND race IN (1,3,4,7,11) ";
    131                 } else $order_side = "";
    132         } else $order_side = "";
     120                }
     121        }
    133122
    134123        require_once("scripts/defines.php");
    135 
     124   
    136125        $result = $sql->query("SELECT guid,name,race,class,zone,map,
    137                         CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_POINTS+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,
    138                         CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level,account,
    139                         CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_GUILD_ID+1)."), ' ', -1) AS UNSIGNED) as GNAME,
    140                         mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".(36+1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender
    141                         FROM `characters` WHERE `online`= 1 $order_side ORDER BY $order_by $order_dir");
     126            CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_POINTS+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,
     127            CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level,
     128            account,
     129            CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_GUILD_ID+1)."), ' ', -1) AS UNSIGNED) as GNAME,
     130            mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".(36+1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender
     131            FROM `characters` WHERE `online`= 1 $order_side ORDER BY $order_by $order_dir");
    142132
    143133        $output .= "
     
    149139        <th width=\"5%\"><a href=\"index.php?order_by=class&amp;dir=$dir\"".($order_by=='class' ? " class=\"$order_dir\"" : "").">{$lang_index['class']}</a></th>
    150140        <th width=\"5%\"><a href=\"index.php?order_by=level&amp;dir=$dir\"".($order_by=='level' ? " class=\"$order_dir\"" : "").">{$lang_index['level']}</a></th>
    151       <th width=\"5%\"><a href=\"index.php?order_by=highest_rank&amp;dir=$dir\"".($order_by=='highest_rank' ? " class=\"$order_dir\"" : "").">Rank</a></th>
    152         <th width=\"15%\"><a href=\"index.php?order_by=GNAME&amp;dir=$dir\"".($order_by=='GNAME' ? " class=\"$order_dir\"" : "").">Guild</a></th>
     141        <th width=\"5%\"><a href=\"index.php?order_by=highest_rank&amp;dir=$dir\"".($order_by=='highest_rank' ? " class=\"$order_dir\"" : "").">{$lang_index['rank']}</a></th>
     142        <th width=\"15%\"><a href=\"index.php?order_by=GNAME&amp;dir=$dir\"".($order_by=='GNAME' ? " class=\"$order_dir\"" :"").">{$lang_index['guild']}</a></th>
    153143        <th width=\"20%\"><a href=\"index.php?order_by=map&amp;dir=$dir\"".($order_by=='map' ? " class=\"$order_dir\"" : "").">{$lang_index['map']}</a></th>
    154         <th width=\"25%\">{$lang_index['zone']}</th>
     144        <th width=\"25%\"><a href=\"index.php?order_by=zone&amp;dir=$dir\"".($order_by=='zone' ? " class=\"$order_dir\"" : "").">{$lang_index['zone']}</th>
    155145        </tr>";
    156146
    157147        require_once("scripts/id_tab.php");
    158148
    159         while($char = $sql->fetch_row($result)){
    160 
    161                 //$guild_name = 'dummy';
    162                 $accid = $char[8];
     149        while ($char = $sql->fetch_row($result))
     150    {
     151            $accid = $char[8];
    163152
    164153        $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    165                 //$sql->db($realm_db['name']);
    166                 $gmlvl = $sql->query("SELECT `gmlevel` FROM `account`WHERE `id`='$accid';");
     154                $gmlvl = $sql->query("SELECT `gmlevel` FROM `account` WHERE `id`=$accid");
    167155                $gml = $sql->fetch_row($gmlvl);
    168156                $gm = $gml[0];
    169157
    170158        $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']);
    171                 //$sql->db($characters_db[$realm_id]['name']);
    172                 $guild_name = $sql->fetch_row($sql->query("SELECT `name` FROM `guild` WHERE `guildid`=".$char[9].";"));
    173 
    174 
    175                 $level = $char[7];
    176 
    177                 if($level > 0)
    178                 {
    179                         $lev = '<font color="#FFFFFF">'.$level.'</font>';
    180                 }
    181                 if($level > 9)
    182                 {
    183                         $lev = '<font color="#858585">'.$level.'</font>';
    184                 }
    185                 if($level > 19)
    186                 {
    187                         $lev = '<font color="#339900">'.$level.'</font>';
    188                 }
    189                 if($level > 29)
    190                 {
    191                         $lev = '<font color="#3300CC">'.$level.'</font>';
    192                 }
    193                 if($level > 39)
    194                 {
    195                         $lev = '<font color="#5552FF">'.$level.'</font>';
    196                 }
    197                 if($level > 49)
    198                 {
    199                         $lev = '<font color="#FF8000">'.$level.'</font>';
    200                 }
    201                 if($level > 59)
    202                 {
    203                         $lev = '<font color="#FF0000">'.$level.'</font>';
    204                 }
    205                 if($level > 69)
    206                 {
    207                         $lev = '<font color="#FF00CC">'.$level.'</font>';
    208                 }
    209                 if($level > 70)
    210                 {
    211                         $lev = '<font color="#FFF000">'.$level.'</font>';
    212                 }
     159                $guild_name = $sql->fetch_row($sql->query("SELECT `name` FROM `guild` WHERE `guildid`={$char[9]}"));
     160
     161
     162    $level = $char[7];
     163
     164    if($level < 10)
     165      $lev = '<font color="#FFFFFF">'.$level.'</font>';
     166    else if($level < 20)
     167      $lev = '<font color="#858585">'.$level.'</font>';
     168    else if($level < 30)
     169      $lev = '<font color="#339900">'.$level.'</font>';
     170    else if($level < 40)
     171      $lev = '<font color="#3300CC">'.$level.'</font>';
     172    else if($level < 50)
     173      $lev = '<font color="#C552FF">'.$level.'</font>';
     174    else if($level < 60)
     175      $lev = '<font color="#FF8000">'.$level.'</font>';
     176    else if($level < 70)
     177      $lev = '<font color="#FFF280">'.$level.'</font>'; 
     178    else if($level < 80)
     179      $lev = '<font color="#FF0000">'.$level.'</font>'; 
     180    else
     181      $lev = '<font color="#000000">'.$level.'</font>';
    213182
    214183                $output .= "<tr>
    215184                 <td><a href=\"char.php?id=$char[0]\"><span onmousemove='toolTip(\"".get_player_user_level($gm)."\",\"item_tooltip\")' onmouseout='toolTip()'>$char[1]</span></a></td>
    216              <td><img src='img/c_icons/{$char[2]}-{$char[10]}.gif' onmousemove='toolTip(\"".get_player_race($char[2])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td>
     185         <td><img src='img/c_icons/{$char[2]}-{$char[10]}.gif' onmousemove='toolTip(\"".get_player_race($char[2])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td>
    217186                 <td><img src='img/c_icons/{$char[3]}.gif' onmousemove='toolTip(\"".get_player_class($char[3])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td>
    218187                 <td>$lev</td>
Note: See TracChangeset for help on using the changeset viewer.