Файл: Source/admin/users.php
Строк: 88
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
include "common.php";
head();
?>
<div class="body content rows scroll-y">
<!-- Page header -->
<div class="page-heading">
<h1><b>Users</b> </h1>
</div>
<!-- End page header -->
<!-- Begin info box -->
<div class="row">
<div class="col-md-12">
<div class="box-info">
<h2>Users</h2>
<?php
include("Classes/Easy_Pagination.php");
// how many records should be displayed on a page?
$records_per_page = 7;
// instantiate the pagination object
$pagination = new Easy_Pagination();
// the MySQL statement to fetch the rows
$MySQL = 'SELECT SQL_CALC_FOUND_ROWS * FROM vn_users WHERE `active`="yes" LIMIT
' . (($pagination->get_page() - 1) * $records_per_page) . ', ' . $records_per_page . '
';
// if query could not be executed
if (!($result = @mysql_query($MySQL))) {
// stop execution and display error message
die(mysql_error());
}
// fetch the total number of records in the table
$rows = mysql_fetch_assoc(mysql_query('SELECT FOUND_ROWS() AS rows'));
// pass the total number of records to the pagination class
$pagination->records($rows['rows']);
// records per page
$pagination->records_per_page($records_per_page);
$page = $pagination->get_page();
?>
<!-- Table -->
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Avatar</th>
<th>User</th>
<th>Points</th>
<th>Email</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$index = 1;
$begin = ($page * $records_per_page) - $records_per_page;
for ($i = 0; $i < mysql_num_rows($result); ++$i) {
$info = mysql_fetch_array($result);
$rank = $i + 1 + $begin;
?>
<tr <?php echo $index++ % 2 ? ' class="active"' : '' ?>>
<td><?php echo $info['id'] ?></td>
<td>
<img style="width:40px;height:40px;" src="<?php echo $GLOBALS['site_url'];?><?php
if(empty($info['avatar'])){
echo 'assets/img/noavatar.png';
}else{
echo $info['avatar'];
}
?>" /></td>
<td><?php echo $info['user'] ?></td>
<td><?php echo $info['points'] ?></td>
<td><?php echo $info['email'] ?></td>
<td>
<a href="view_user.php?id=<?php echo $info['id']; ?>" class="btn btn-info">View user</a>
<a href="block_user.php?id=<?php echo $info['id']; ?>" class="btn btn-danger">Block user</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
// show the pagination links
$pagination->render();
?>
</div>
<div class="box-info">
<h2>Blocked users</h2>
<!-- Table -->
<table class="table">
<thead>
<tr>
<th>#</th>
<th>User</th>
<th>Reason</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
$blocked_users = mysql_query("SELECT * FROM `vn_blocked`");
while ($row = mysql_fetch_array($blocked_users)) {
?>
<tr>
<td><?php echo $i++; ?></td>
<td><?php
$info_for = mysql_query("SELECT * FROM `vn_users` WHERE `id`=$row[userid]");
$row_user = mysql_fetch_array($info_for);
echo $row_user['user'];
?></td>
<td><?php echo $row['reason']; ?></td>
<td><a href="unblock_user.php?id=<?php echo $row['id']; ?>" class="btn btn-success">Unblock user</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
footer();
?>
</div>
</div>