Файл: Source/pages/rankings.php
Строк: 289
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
require_once 'inc/header.php';
?>
<body class="no-slider">
<!-- <body class="has-top-menu"> -->
<!-- BEGIN #slider-imgs -->
<div id="slider-imgs">
<div class="featured-img-box">
<div id="featured-img-1" class="featured-img"></div>
<div id="featured-img-2" class="featured-img invisible"></div>
<div id="featured-img-3" class="featured-img invisible"></div>
<div id="featured-img-4" class="featured-img invisible"></div>
</div>
<!-- END #slider-imgs -->
</div>
<!-- BEGIN #top-layer -->
<div id="top-layer">
<div id="header-top">
<?php
require_once 'inc/header_top.php';
?>
</div>
<section id="content">
<header id="header">
<div id="menu-bottom">
<?php
require_once 'inc/menu_bottom.php';
?>
</div>
<div class="wrapper">
<div class="header-breadcrumbs">
<?php
require_once 'inc/stats.php';
?>
<ul>
<li><a href="index.php">Home</a></li>
<li>Rankings </li>
</ul>
</div>
</div>
</header>
<div id="main-box" class="full-width">
<div id="main">
<div class="signup-panel">
<div class="">
<h2><span>Rankings</span></h2>
<div class="content-padding">
<div class="input-group" style="width:100%">
<form method='post' name='search'>
<input type="text" name='s' placeholder="Search users..."
class="form-control" style="float:left;width:85%;">
<span class="" style="float:right;">
<button type="submit" class="button" style="padding:6px;" type="button">Search</button>
</span>
</form>
</div><!-- /input-group -->
<br />
<br />
<?php
if (isset($_POST['s'])) {
if (eregi("[^a-zA-Z0-9_.-]", $_POST['s'])) {
echo "<div class='msg-error'>The username must not contain special characters.</div>";
$wheref = "-none";
} else {
$where = str_replace(" ", "", $_POST['s']);
$where = sprintf("%s", mysql_real_escape_string($where));
$ls = $where;
$wheref = "-$where";
$where = " and user LIKE '%$where%'";
}
} elseif (isset($_GET['s'])) {
$where = str_replace(" ", "", $_GET['s']);
$where = sprintf("%s", mysql_real_escape_string($where));
$ls = $where;
$wheref = "-$where";
$where = " and user LIKE '%$where%'";
} else {
$wheref = "-none";
}
if ($wheref == "-") {
$wheref = "-none";
}
if ($wheref == "-none") {
$ls = "";
$where = "";
}
$checkalln = mysql_query("SELECT id FROM vn_users WHERE user!='Admin' and user!='Real-Gamers'$where");
$broi = mysql_num_rows($checkalln);
$pp = 20;
if ($broi > 0) {
$pages = ceil($broi / $pp);
$page = (int) $_GET['p'];
$page = sprintf("%s", mysql_real_escape_string($page));
if ($page == 0 || $page < 0 || $page == NULL) {
$page = 1;
}
if ($page > $pages) {
$page = $pages;
}
$begin = ( $page * $pp ) - $pp;
if ($_GET['filter'] == "user") {
$under = " text-decoration:underline;";
} elseif ($_GET['filter'] == "points") {
$under2 = " text-decoration:underline;";
} elseif ($_GET['filter'] == "wonprizes") {
$under3 = " text-decoration:underline;";
} else {
$under2 = " text-decoration:underline;";
}
echo "
<table class='blue'>
<thead>
<tr>
<th>#</th>
<th>Avatar</th>
<th>User</th>
<th style='text-align:center;'>Points</th>
<th style='text-align:center;'>Prize</th>
<th style='text-align:center;'>Status</th>
<th style='text-align:center;'>Action</th>
</tr>
</thead>";
$filter = sprintf("%s", mysql_real_escape_string($_GET['filter']));
if ($filter != "user" and $filter != "points" and $filter != "wonprizes") {
$filter = "points";
}
if ($filter == "user") {
$order = "ASC";
} else {
$order = "DESC";
}
$result = mysql_query("SELECT * FROM vn_users WHERE user!='bobsibe' $where ORDER by {$filter} {$order} LIMIT {$begin},{$pp}") or die(mysql_error());
for ($i = 0; $i < mysql_num_rows($result); ++$i) {
$row = mysql_fetch_array($result);
$rank = $i + 1 + $begin;
$time = time();
if ($row['lastact'] < $time - 600 or $row['loged'] == 0) {
$status = '<img src="assets/img/rankings/offline.png" align="absmiddle" title="Offline" /> Offline';
} else {
$status = '<img src="assets/img/rankings/online.png" align="absmiddle" title="Online" /> Online';
}
if (empty($row['avatar'])) {
$avatar = "uploads/avatars/noavatar.png";
} else {
$avatar = $row['avatar'];
}
$pored = '<font style="font-size:25px;text-align:center;">' . $rank . '</font><Br>';
echo "
<tr>
<td style='text-align:center;padding-top:15px;'>$pored</td>
<td style='text-align:center;'><img src='$avatar' style='width:50px;border-radius:50%;' alt=''/></td>
<td><a href='/u:$row[user]' style='color:#545454;'>$row[user] </a> $vip</td>
<td style='text-align:center;'>".number_format($row['points'], 0, ',', ' ')."</td>
<td style='text-align:center;'>$row[wonprizes]</td>
<td style='text-align:center;'>$status</td>
<td style='text-align:center;'><a href='/u:$row[user]' class='button' style='background-color: #519623;'>View profile</a></td>
</tr>";
}
$next = $page + 1;
$next2 = $page + 2;
$prev = $page - 1;
$prev2 = $page - 2;
if($pages >= $next) {
$nexts = "<button type='button' class='page' onClick="jump('/rankings:$filter-$next$wheref');">></button>";
$pageup1 = "<button type='button' class='page' onClick="jump('/rankings:$filter-$next$wheref');">$next</button>";
} else {
$nexts = "<button type='button' class='npage' disabled='disabled'>></button>";
}
if($pages >= $next2) {
$pageup2 = "<button type='button' class='page' onClick="jump('/rankings:$filter-$next2$wheref');">$next2</button>";
$last = "<button type='button' class='page' onClick="jump('/rankings:$filter-$pages$wheref');">>></button>";
} elseif($pages >= $next) {
$last = "<button type='button' class='page' onClick="jump('/rankings:$filter-$pages$wheref');">>></button>";
} else {
$last = "<button type='button' class='npage' disabled='disabled'>>></button>";
}
if($page > 2) {
$pagedw2 = "<button type='button' class='page' onClick="jump('/rankings:$filter-$prev2$wheref');">$prev2</button>";
$first = "<button type='button' class='page' onClick="jump('/rankings:$filter-1$wheref');"><<</button>";
} else {
$first = "<button type='button' class='npage' disabled='disabled'><<</button>";
}
if($page > 1) {
$prevs = "<button type='button' class='page' onClick="jump('/rankings:$filter-$prev$wheref');"><</button>";
$pagedw1 = "<button type='button' class='page' onClick="jump('/rankings:$filter-$prev$wheref');">$prev</button>";
$first = "<button type='button' class='page' onClick="jump('/rankings:$filter-1$wheref');"><<</button>";
} else {
$prevs = "<button type='button' class='npage' disabled='disabled'><</button>";
}
if($page == 1 and $pages > 3) {
$pageup3 = "<button type='button' class='page' onClick="jump('/rankings:$filter-4$wheref');">4</button>";
}
if($page == 1 and $pages > 4 or $page == 2 and $pages > 4) {
$pageup4 = "<button type='button' class='page' onClick="jump('/rankings:$filter-5$wheref');">5</button>";
}
if($page == $pages and $pages < 5) {
$pagedw3 = "<button type='button' class='page' onClick="jump('/rankings:$filter-1$wheref');">1</button>";
} echo "</table>";
if($broi > $pp) {
echo "<div class='styled_text' style=''>
<br /> <br />
<div style='float:left;'><img src='assets/img/rankings/pages.png' align='absmiddle'> Pages</div><div style='float:right;'>Total $broi player in rankings
<img src='assets/img/rankings/pages.png' align='absmiddle'></div> <br /> <br />
$first $prevs $pagedw3 $pagedw2 $pagedw1 <button class='npage' disabled='disabled'>$page</button> $pageup1 $pageup2 $pageup3 $pageup4 $nexts $last
<br /><br />
</div>";
}
} else { echo "<br /><div class='info-message'>No users found.</div>";
}
?>
</div>
</div>
<div class="clear-float"></div>
</div>
</div>
<div class="clear-float"></div>
</div>
</div>
</div>
<?php
require_once 'inc/footer.php';
?>