Changeset 11
Legend:
- Unmodified
- Added
- Removed
-
index.php
r8 r11 15 15 //language 16 16 if (isset($_COOKIE['lang'])) 17 17 { 18 18 $lang = $_COOKIE['lang']; 19 } 20 else 21 { 22 $lang = 'cs'; 23 } 19 } 20 else $lang = 'cs'; 24 21 require('./lang/'.$lang.'.php'); 25 22 … … 28 25 if(!array_key_exists('page', $geted)) $geted['page'] = 'servers'; 29 26 $page_info = $db->query_fetch_assoc('SELECT * FROM `pages` WHERE `page` LIKE "'.$geted['page'].'"'); 30 if 31 27 if(empty($page_info)) 28 { 32 29 $page_info = $db->query_fetch_assoc('SELECT * FROM `pages` WHERE `page` LIKE "servers"'); 33 30 } 34 31 $page_info['tpl'] = eregi_replace("\-", "_", $page_info['page']); 35 32 $tpl->template = './templates/'.$page_info['tpl'].'.html'; … … 37 34 $tpl->output['top_online_data'] = ''; 38 35 $tpl->output['top_rating_data'] = ''; 39 if ($page_info['menu']==1)40 36 if($page_info['menu'] == 1) 37 { 41 38 $tpl->menu_template = './templates/menu.html'; 42 39 $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']); 51 61 $tpl->output['top_rating_data'] = ''; 52 while 53 62 while($row = $db->strip($db->fetch_assoc('top_rating'))) 63 { 54 64 $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>'; 63 66 } 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 } 74 else $tpl->output['bg_color'] = '#e6e6e6'; 75 68 76 $tpl->output['title'] = 'WSS - '.$page_info['title']; 69 77 $tpl->output['url'] = $config['base_url']; 70 78 $tpl->output['lang'] = $lang; 71 79 $tpl->output['footer'] = 'Vytvořeno členy komunity.'; 72 if 73 74 $tpl->output['acc'] = ulink('action.php?do=logout', 'Logout');75 80 if(isset($_SESSION['id'])) 81 { 82 $tpl->output['acc'] = ulink('action.php?do=logout', 'Logout'); 83 } 76 84 else 77 85 { 78 86 $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 } 80 88 81 89 $tpl->output['top_online'] = $text['top_online']; 82 90 $tpl->output['top_rating'] = $text['top_rating']; 83 91 84 if 85 92 if(isset($_SESSION['id'])) 93 { 86 94 $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 } 96 if(($page_info['admin'] == 1) AND $user['admin'] <> 1) 97 { 90 98 die('Hacking attemp'); 91 99 } 92 100 93 101 include $p;
Note:
See TracChangeset
for help on using the changeset viewer.