Вход Регистрация
Файл: www/system/page.php
Строк: 121
<?php
/*----------Скрипт постраничной навигации----------*/
/*-------------Версия скрипта: v1.0----------------*/
/*------------Автор скрипта: SM_KLOK---------------*/
/*-----------Контакты: https://vk.com/sm_klok------*/
/*-----------Email: klochko.2912@bk.ru-------------*/
#-Скрипт поиска страниц-#
$act = isset($_GET['act'])  ? htmlspecialchars($_GET['act']) : '';
switch(
$act){
case 
'search':
if(isset(
$_POST['page']) and preg_match('/^[0-9]+$/u',$_POST['page'])){
$page htmlspecialchars($_POST['page']);
header("Location: ?page=$page");
exit();
}else{
header("Location: ?page=1");
exit();    
}
}
?>
<style>
#page_a{
    font-family:Verdana, Arial, sans-serif;
    font-size:15px;
    position: relative;
    border: 1px solid #6f6e6e;
    margin-right: 3px;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 5px;
    padding-bottom: 5px;
    border-radius: 4px;
    background-color: #636262;
    color: #fff;
    text-decoration: none;
}
#page_a:hover{
    border: 1px solid #5e5c5c;
    background-color: #505050;
}
.page_t{
    border: 1px solid #4a4747;
    margin-right: 3px;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 5px;
    padding-bottom: 5px;
    border-radius: 4px;
    background-color: #3e3b3b;
    color: #fff;
}
#page_active{
    position: relative;
    margin-right: 3px;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 5px;
    padding-bottom: 5px;
    border-radius: 4px;
    color: #fff;
    border: 1px solid #5e5c5c;
    background-color: #505050;
    text-decoration: none;
}
.img_search{
    padding-left: 10px;
    padding-right: 8px;
    padding-top: 5px;
    padding-bottom: 5px;
    background: url(/search.png);
    background-repeat: no-repeat;
}
.form_search{
    width: 150px;
    height: 25px;
    border-radius: 2px;
    outline: none;
}
.button_search{
    font-size: 15px;
    outline: none;
    border: 1px solid #6f6e6e;
    border-radius: 4px;
    background-color: #636262;
    color: #fff;    
    padding-top: 2px;
    padding-bottom: 2px;
    padding-left: 7px;
    padding-right: 7px;
}
.button_search:hover{
    border: 1px solid #5e5c5c;
    background-color: #505050;
}
</style>
<?
function PageUrl($url){
if(
$url == ''){
$action '?';
}else{
if(
preg_match('/?page=[0-9]/'$url)){
$action "?";
}else{
$url preg_replace('/&page=?(.+)[0-9]/is'''$url);
$url preg_replace('/?/'''$url);
$action "?$url&";
}
}
return 
$action;
}
function 
SearchPageUrl($url){
if(
$url == ''){
$action '?';
}else{
if(
preg_match('/?page=[0-9]/'$url)){
$url preg_replace('/&search_page=?(.+)[a-z]/is'''$url);
$url preg_replace('/?/'''$url);
$action_search  "?$url&";
}else{
$url preg_replace('/&search_page=?(.+)[a-z]/is'''$url);
$url preg_replace('/?/'''$url);
$action_search  "?$url&";
}
}
return 
$action_search;
}
#-ФУНКЦИЯ ВЫВОДА СТРАНИЦ-#
function page($posts,$total,$num){
$url $_SERVER['REQUEST_URI'];
$url preg_replace('/&{2,}/''&'$url);
$url preg_replace('///'''$url);
$action PageUrl($url);
$action_search SearchPageUrl($url);
$page htmlspecialchars($_GET['page']);
$page intval($page);
if(!
preg_match('/^[0-9]+$/u'$page)){$page 1;}
if(empty(
$page) or $page 0$page 1;
$total intval(($posts 1) / $num) + 1;
if(
$page $total$page $total;
$start $page $num $num;
if(
$total 1){
if(isset(
$_GET['search_page']) and $_GET['search_page'] == 'on'){
$search_page "<a href='".$action_search."search_page=off' id='page_active'><span class='img_search'></span></a>"
}else{
$search_page "<a href='".$action_search."search_page=on' id='page_a'><span class='img_search'></span></a>"
}
}
if(
$page != 1$start_page "<a href='".$action."page=1' class='ajax_page' id='page_a'>В начало</a>";  
if(
$page != $total$end_page "<a href='".$action."page=$total' class='ajax_page' id='page_a'>В конец</a>";  
if(
$page 0){
$back_page "<a href='".$action."page=".($page 1)."' class='ajax_page' id='page_a'><</a>"
$back_one "<a href='".$action."page=".($page 1)."' class='ajax_page' id='page_a'>".($page 1)."</a>"
}
if(
$page 0$back_two "<a href='".$action."page=".($page 2)."' class='ajax_page' id='page_a'>".($page 2)."</a>"
if(
$page 0$back_three "<a href='".$action."page=".($page 3)."' class='ajax_page' id='page_a'>".($page 3)."</a>"
if(
$page <= $total){
$forward_one "<a href='".$action."page=".($page 1)."' class='ajax_page' id='page_a'>".($page 1)."</a>"
$next_page "<a href='".$action."page=".($page 1)."' class='ajax_page' id='page_a'>></a>"
}
if(
$page <= $total$forward_two "<a href='".$action."page=".($page 2)."' class='ajax_page' id='page_a'>".($page 2)."</a>";  
if(
$page <= $total$forward_three "<a href='".$action."page=".($page 3)."' class='ajax_page' id='page_a'>".($page 3)."</a>";
#-Форма поиска-#
echo'<center>';
if(isset(
$_GET['search_page']) and $_GET['search_page'] == 'on'){
echo
'<form method="post" action="?act=search">';
echo
'<input class="form_search" type="number" name="page"/> ';
echo
'<input class="button_search" type="submit"  value="Поиск"/>';
echo
'</form>';
echo
'</div>';
}
echo
"$start_page$back_page$back_three$back_two$back_one<b><span class='page_t'>$page</span></b>$forward_one$forward_two$forward_three$next_page$search_page$end_page";  
echo
'</center>';
}
?>
Онлайн: 0
Реклама