display('header.tpl'); $text_error = '
Ошибочка вышла!'; $connect = mysql_connect ($server, $user, $pass); if (!$connect) { echo $text_error; exit; } $select = mysql_select_db($db); if (!$select) { echo $text_error; exit; } $no_activ = time() - $max_inactivity * 24 * 60 * 60; function dateShort($timestamp) { // 20-04-03 setlocale (LC_TIME, 'rus'); $date = strftime("%d/%m/%y", $timestamp); return $date; } $result = mysql_query("SELECT * from $table WHERE `timestamp` > $no_activ "); $num_rows = mysql_num_rows($result); $num_rows = ceil($num_rows/$chislo); if (isset($_GET['str'])) { $nav = $_GET['str']; }else { $nav = 1; } $nav = intval($nav); if(isset($_GET['sort'])&& ($_GET['sort'] == games || $_GET['sort'] == timestamp || $_GET['sort'] == map || $_GET['sort'] == ct_win || $_GET['sort'] == t_win || $_GET['sort'] == online_time || $_GET['sort'] == first_game)){ $sort= $_GET['sort']; }else { $sort = games; } if (!isset($_GET['str'])) { $str = 0; }else { $str = $_GET['str']*$chislo - $chislo; } $nomer = $str + $chislo; mysql_query("SET @_c = 0"); $r = mysql_query("SELECT * FROM $table WHERE `timestamp` > $no_activ ORDER by $sort desc limit $str, $chislo"); if (!$result) { echo $text_error; exit; } while ($row = mysql_fetch_array($r)) { $map=$row['map']; $ct_win=$row['ct_win']; $t_win=$row['t_win']; $games=$row['games']; $time=$row['timestamp']; $data=dateShort($time); $screen = $map; if (file_exists('img/'.$screen.'.jpg')) $screeen = "$screen"; else $screeen = "noimage"; $online = $row['online_time']; $hours = floor($online/(60*60)); $mins = ceil($online / 60) - (floor(($online/60)/60))*60 ; $row[h] = ($hours < 10 ? '0' : ''); $row[m] = ($mins < 10 ? '0' : ''); $row[hours] = $hours; $row[mins] = $mins; $first_date = $row['first_date']; $row[first_date] = dateShort($first_date); $row[screeen] = $screeen ; if($ct_win !=0 && $t_win !=0){ $row[procent_ct] = round($ct_win / (($ct_win + $t_win)/100)); $row[procent_t] = round($t_win / (($ct_win + $t_win)/100)); }else{ $row[procent_ct] = 0; $row[procent_t] = 0; } $row[i] = $i++; //$row[bcolor] = $i % 2 == 0 ? "#FFFFFF" : "#E1E4E8"; $row[data] = $data; $rows[]=$row; } $smarty->assign('maps', $rows); mysql_close($connect); for ($i=1; $i<=$num_rows; $i++) { if ($i != $nav) { $page[] = ''.$i.''; $stranica .=$i; }else{ $page[] = ' '.$i.' '; } } $smarty->assign("page",$page); $smarty->display('map_stats_body.tpl'); $smarty->display('footer.tpl'); ?>