Файл: admin/poisk.php
Строк: 99
<?php
define('NTOP', 1);
$title = 'Админка - поиск площадками';
require_once('../system/connect.php');
require_once('../system/core.php');
require_once('../system/function.php');
require_once('../system/head.php');
require_once ('../system/panel.php');
reg();
level(2);
echo '<div class="container" id="page"><h1>Поиск сайта</h1><hr/>';
echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF']).'" method="POST" name="form">
<label for="search" class="required">Введите запрос <small>[min 4 , max 60 символов]</small></label><br/>
<input size="25" maxlength="25" class="form-control" placeholder="Пример: site.ru" id="search" type="text" name="search" maxlenght="60" value="'.htmlspecialchars($_POST['search']).'"/><br/>
<label for="m" class="required">Параметры поиска </label><br/>
<select id="m" name="m">
<option value="1">url</option>
<option value="2">название сайта</option>
<option value="3">описание сайта</option>
</select><br/>
<input name="n" type="checkbox" value="1"/> Точный поиск<br/>
<div class="form-group buttons"><input class="btn btn-success" type="submit" name="go" value="Поиск"></div>
</form></div>';
if (isset($_POST['go']) ) {
if (empty($_POST['search'])) {
$error[1] = 'Вы не ввели адрес сайта !';
}
if (mb_strlen($_POST['search']) < 3 || mb_strlen($_POST['search']) > 64 ) {
$error[2] = 'Длина запроса должна быть не менее 3 символов и не привышать 64 символа !';
}
}
if (!empty($error)) {
echo '<div class="title">';
foreach($error as $value) {
echo "<b>$value</b> <br />";
}
echo '</div>';
require_once ('../m/foot.php');
exit();
}
$mm = isset ($_POST['m']) ? intval($_POST['m']) : '';
$mm = $mm ? $mm : rawurldecode(trim($_GET['m']));
$n = isset ($_POST['n']) ? $_POST['n'] : '';
$n = $n ? $n : rawurldecode(trim($_GET['n']));
$search = isset ($_POST['search']) ? trim($_POST['search']) : '';
$search = strtr($search, array('_' => '\_', '%' => ' ','$' => ' ', '*' => '%'));
$search = $search ? $search : rawurldecode(trim($_GET['search']));
if ($search) {
$search_db = 'LIKE '' . mysql_real_escape_string('%' . $search . '%') . ''';
if ($_POST['n'] == false) $search_db = 'LIKE '' . mysql_real_escape_string('%' . $search . '%') . ''';
if ($_POST['n'] == true) {
$search_db = '= "'.mysql_real_escape_string($search).'"';
}
$zap = '`about`';
if ($_POST['m'] == 1 || $_GET['mm'] == 1) $zap = '`url`';
if ($_POST['m'] == 2 || $_GET['mm'] == 2) $zap = '`name`';
if ($_POST['m'] == 3 || $_GET['mm'] == 3) $zap = '`about`';
$count = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE ".$zap." ".$search_db." "));
if($count > 0)
{
$total=intval(($count-1)/$page_sait)+1;
$page=abs(intval($_GET['page']));
if(empty($page) OR $page < 0)
{
$page = 1;
}
if($page > $total)
{
$page = $total;
}
$past=intval($count/$page_sait);
$start=$page*$page_sait-$page_sait;
$saits = mysql_query("SELECT * FROM `".$prefix."sait` WHERE ".$zap." ".$search_db." ORDER BY `id` DESC LIMIT ".$start.",".$page_sait."");
echo'<div class="container" id="page"><div class="rating">';
while($row = mysql_fetch_array($saits))
{
$start++;
$ban = ($row['ban'] == 0) ? '<a class="server_status_offline" data-toggle="tooltip" data-placement="bottom" href="http://'.$set['home'].'/admin/platforms.php?act=ban&id='.$row['id'].'">Блокировать</a>' : '<a class="server_status_online" data-toggle="tooltip" data-placement="bottom" href="http://'.$set['home'].'/admin/platforms.php?act=ban&id='.$row['id'].'">Разблокировать</a>';
echo'
<div class="project">
<div class="name"><a href="http://'.$set['home'].'/stats/'.$row['id'].'">'.$row['url'].'</a></div>
<div class="banner">
<a href="http://'.$set['home'].'/stats/'.$row['id'].'"><img src="http://mini.s-shot.ru/468x90/468/png/?'.$row['url'].'"/></a>
</div>
<div class="votes">Стата: '.$row['hosts'].' / '.$row['hits'].'</div>
<div class="votes">Место: '.$start.'</div>
<div class="servers">
<a class="server_status_online" data-toggle="tooltip" data-placement="bottom" href="http://'.$set['home'].'/admin/platforms.php?act=edit_sait&id='.$row['id'].'">Изменить</a>
<a class="server_status_offline" data-toggle="tooltip" data-placement="bottom" href="http://'.$set['home'].'/admin/platforms.php?act=del_sait&id='.$row['id'].'">Удалить сайт</a>
'.$ban.'
</div>
</div>';
}
navigation($count,$page_sait,$page,'http://'.$set['home'].'/adm_panel/poisk.php?search='.$search.'&n=0&mm='.$mm.'&page=',$total);
echo'</div></div>';
}
else {
echo '<div class="title">Ничего не найдено !</div>';
}
echo '<div class="container" id="page"><div class="rating">Совпадений : '.$count.'</div></div>';
}
echo'</div></div>';
require_once('../modules/foot.php');
?>