Changeset 307 for minimanager/index.php


Ignore:
Timestamp:
Mar 13, 2008, 8:18:42 PM (17 years ago)
Author:
george
Message:

Aktualizace na minimanager 0.1.6g.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • minimanager/index.php

    r304 r307  
    2222if (test_port($server[$realm_id]['addr'],$server[$realm_id]['game_port'])) {
    2323
    24         $query = $sql->query("SELECT uptime FROM uptime ORDER BY starttime DESC LIMIT 1");
    25         $uptime = $sql->result($query, 0);
    26         $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>";
     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*/
     29    $query = $sql->query("SELECT `starttime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1");
     30    $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     );
     38if ($uptime[d] < 2) {
     39$sd = ""; }
     40else {
     41$sd = "s"; }
     42
     43if ($uptime[h] < 2) {
     44$sh = ""; }
     45else {
     46$sh = "s"; }
     47
     48if ($uptime[m] < 2) {
     49$sm = ""; }
     50else {
     51$sm = "s"; }
     52
     53if ($uptime[s] < 2) {
     54$ss = ""; }
     55else {
     56$ss = "s"; }
     57
     58if ($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
    2768        $online = true;
    2869        } else {
     
    3071                $online = false;
    3172                }
    32 $output .= "Mangos: {$server[$realm_id]['rev']} Using DB: {$mangos_db[$realm_id]['db_rev']}</div>";
     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);
     78$output .= "Mangos: {$server[$realm_id]['rev']} Using DB: $db_rev</div>";
    3379
    3480$sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']);
     
    75121        $dir = ($dir) ? 0 : 1;
    76122
    77         $result = $sql->query("SELECT count(*) FROM `character` WHERE `online`= 1");
     123        $result = $sql->query("SELECT count(*) FROM `characters` WHERE `online`= 1");
    78124        $total_online = $sql->result($result, 0);
    79125
    80126        if( !$user_lvl && !$server[$realm_id]['both_factions']){
    81                 $result = $sql->query("SELECT race FROM `character` WHERE account = '$user_id' AND totaltime = (SELECT MAX(totaltime) FROM `character` WHERE account = '$user_id') LIMIT 1");
     127                $result = $sql->query("SELECT race FROM `characters` WHERE account = '$user_id' AND totaltime = (SELECT MAX(totaltime) FROM `characters` WHERE account = '$user_id') LIMIT 1");
    82128                if ($sql->num_rows($result)){
    83129                        $order_side = (in_array($sql->result($result, 0, 'race'),array(2,5,6,8,10))) ?
     
    93139                        CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_GUILD_ID+1)."), ' ', -1) AS UNSIGNED) as GNAME,
    94140                        mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".(36+1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender
    95                         FROM `character` WHERE `online`= 1 $order_side ORDER BY $order_by $order_dir");
     141                        FROM `characters` WHERE `online`= 1 $order_side ORDER BY $order_by $order_dir");
    96142
    97143        $output .= "
Note: See TracChangeset for help on using the changeset viewer.