Файл: Source/admin/search.php
Строк: 78
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
include "common.php";
head();
$keywords = str_replace(" ", "", $_GET['keywords']);
$keywords = sprintf("%s", mysql_real_escape_string($keywords));
?>
<div class="body content rows scroll-y">
<!-- Page header -->
<div class="page-heading">
<h1><b>Search user <?php echo $keywords; ?></b> </h1>
</div>
<!-- End page header -->
<!-- Begin info box -->
<div class="row">
<div class="col-md-12">
<div class="box-info">
<h2>Search user <?php echo $keywords; ?></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 `user` LIKE "' . $keywords . '" 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 '/img/avatars/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="block_user.php?id=<?php echo $info['id']; ?>" class="btn btn-danger">Block user</a>
<a href="view_user.php?id=<?php echo $info['id']; ?>" class="btn btn-info">Edit user</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
// show the pagination links
$pagination->render();
?>
</div>
<?php
footer();
?>
</div>
</div>