Changeset 11


Ignore:
Timestamp:
Jun 8, 2008, 12:09:09 PM (17 years ago)
Author:
george
Message:

Upraveno: Zobrazování žebříčku nejlepších serverů podle zobrazené skupiny české, zahraniční, partnerské.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • index.php

    r8 r11  
    1515//language
    1616if (isset($_COOKIE['lang']))
    17   {
     17{
    1818  $lang = $_COOKIE['lang'];
    19   }
    20 else
    21   {
    22   $lang = 'cs';
    23   } 
     19}
     20else $lang = 'cs';
    2421require('./lang/'.$lang.'.php');
    2522
     
    2825if(!array_key_exists('page', $geted)) $geted['page'] = 'servers';
    2926$page_info = $db->query_fetch_assoc('SELECT * FROM `pages` WHERE `page` LIKE  "'.$geted['page'].'"');
    30 if  (empty($page_info))
    31   {
     27if(empty($page_info))
     28{
    3229  $page_info = $db->query_fetch_assoc('SELECT * FROM `pages` WHERE `page` LIKE "servers"');
    33   }
     30}
    3431$page_info['tpl'] = eregi_replace("\-", "_", $page_info['page']); 
    3532$tpl->template = './templates/'.$page_info['tpl'].'.html';
     
    3734$tpl->output['top_online_data'] = '';
    3835$tpl->output['top_rating_data'] = '';
    39 if ($page_info['menu']==1)
    40   {
     36if($page_info['menu'] == 1)
     37{
    4138  $tpl->menu_template = './templates/menu.html';
    4239  $tpl->output['bg_color'] = '#ffffff';
    43   $db->query('top_online','SELECT `id`, LEFT(`name`, 25) as `name`, CAST(`online_players_sum`/`player_checks` AS UNSIGNED) as online FROM `servers` ORDER BY `online` DESC LIMIT '.$Config['TopServersCount']);
    44   $tpl->output['top_online']='';
    45   while ($row = $db->strip($db->fetch_assoc('top_online')))
    46     {
    47     if ($row['online']==0) $row['online']=0;
    48     $tpl->output['top_online_data'].='<li>'.ulink('server/'.$row['id'], $row['name']).' - '.$row['online'].' '.$text['players'].'</li>';
    49     }
    50   $db->query('top_rating','SELECT `id`, LEFT(`name`, 25) as `name`, `rating_sum`/`ratings` as rating FROM `servers` ORDER BY `rating` DESC LIMIT '.$Config['TopServersCount']);
     40
     41  // Filter top servers
     42  $Filter = '';
     43  if(array_key_exists('page', $_GET))
     44  {
     45    if($_GET['page'] == 'servers') $Filter = 'WHERE place=1';
     46    if($_GET['page'] == 'a-servers') $Filter = 'WHERE place=2';
     47    if($_GET['page'] == 'wss-partners') $Filter = 'WHERE wss_partner=1';
     48  }
     49
     50  // Show top player count servers
     51  $db->query('top_online', 'SELECT `id`, LEFT(`name`, 25) as `name`, CAST(`online_players_sum`/`player_checks` AS UNSIGNED) as online FROM `servers` '.$Filter.' ORDER BY `online` DESC LIMIT '.$Config['TopServersCount']);
     52  $tpl->output['top_online'] = '';
     53  while($row = $db->strip($db->fetch_assoc('top_online')))
     54  {
     55    if($row['online'] == 0) $row['online'] = 0;
     56    $tpl->output['top_online_data'] .= '<li>'.ulink('server/'.$row['id'], $row['name']).' - '.$row['online'].' '.$text['players'].'</li>';
     57  }
     58
     59  // Show top rating servers
     60  $db->query('top_rating','SELECT `id`, LEFT(`name`, 25) as `name`, `rating_sum`/`ratings` as rating FROM `servers` '.$Filter.' ORDER BY `rating` DESC LIMIT '.$Config['TopServersCount']);
    5161  $tpl->output['top_rating_data'] = '';
    52   while ($row = $db->strip($db->fetch_assoc('top_rating')))
    53     {
     62  while($row = $db->strip($db->fetch_assoc('top_rating')))
     63  {
    5464    $row['rating'] = round($row['rating'], 2);
    55     $tpl->output['top_rating_data'].='<li>'.ulink('server/'.$row['id'], $row['name']).' - '.$row['rating'].'</li>';
    56     }
    57   $tpl->output['mm6'] =menuitem('home', $menu['mm1']);
    58   $tpl->output['mm1'] =menuitem('index.php?page=wss-partners', $menu['mm2']);
    59   $tpl->output['mm2'] =menuitem('index.php?page=servers', $menu['mm3']);
    60   $tpl->output['mm3'] =menuitem('index.php?page=a-servers', $menu['mm4']);
    61   $tpl->output['mm4'] =menuitem('index.php?page=users', $menu['mm5']);
    62   $tpl->output['mm5'] =menuitem('add-server/', $menu['mm6']);
     65    $tpl->output['top_rating_data'] .= '<li>'.ulink('server/'.$row['id'], $row['name']).' - '.$row['rating'].'</li>';
    6366  }
    64 else
    65   {
    66   $tpl->output['bg_color'] = '#e6e6e6';
    67   }
     67  $tpl->output['mm6'] = menuitem('home', $menu['mm1']);
     68  $tpl->output['mm1'] = menuitem('index.php?page=wss-partners', $menu['mm2']);
     69  $tpl->output['mm2'] = menuitem('index.php?page=servers', $menu['mm3']);
     70  $tpl->output['mm3'] = menuitem('index.php?page=a-servers', $menu['mm4']);
     71  $tpl->output['mm4'] = menuitem('index.php?page=users', $menu['mm5']);
     72  $tpl->output['mm5'] = menuitem('add-server/', $menu['mm6']);
     73}
     74else $tpl->output['bg_color'] = '#e6e6e6';
     75
    6876$tpl->output['title'] = 'WSS - '.$page_info['title'];
    6977$tpl->output['url'] = $config['base_url'];
    7078$tpl->output['lang'] = $lang;
    7179$tpl->output['footer'] = 'Vytvořeno členy komunity.';
    72 if (isset($_SESSION['id']))
    73   {
    74   $tpl->output['acc'] =ulink('action.php?do=logout', 'Logout');
    75   }
     80if(isset($_SESSION['id']))
     81{
     82  $tpl->output['acc'] = ulink('action.php?do=logout', 'Logout');
     83}
    7684else
    77   {
     85{
    7886  $tpl->output['acc'] = window_open($config['base_url'].'index.php?page=register', 'Registrace', 400, 350, 400, 250).'  |  '.window_open($config['base_url'].'index.php?page=login', 'Login', 200, 140, 500, 300);
    79   }
     87}
    8088
    8189$tpl->output['top_online'] = $text['top_online'];
    8290$tpl->output['top_rating'] = $text['top_rating'];
    8391
    84 if (isset($_SESSION['id']))
    85   {
     92if(isset($_SESSION['id']))
     93{
    8694  $user = $db->strip($db->query_fetch_assoc('SELECT * from `users` WHERE id ='.(int)$_SESSION['id']));
    87   }
    88 if (($page_info['admin']==1) AND $user['admin']<>1)
    89   {
     95}
     96if(($page_info['admin'] == 1) AND $user['admin'] <> 1)
     97{
    9098  die('Hacking attemp');
    91   }
     99}
    92100
    93101include $p;
Note: See TracChangeset for help on using the changeset viewer.