Файл: public_html/my_admin/inc/fun.php
Строк: 112
<?php
#by FeST
#ICQ : 3452223
#Mini phpMyADMIN v.2
#______Конфиги ______#
$set_password='Makaka';// Пароль от админкu
$set_host='localhost';
$set_user='db1400882215';//пользователь mysql
$set_pass='makaka';//пароль от базы данных
$set_base='db1400882215';// название базы
#____________________#
@mysql_connect($set_host, $set_user, $set_pass) or die('Нет соединения с сервером базы');
@mysql_select_db($set_base)or die('Нет доступа к выбранной базе данных');
mysql_query('SET NAMES "utf8"');
#______Функции_______#
function mes_sql($str){
echo "<div class='msg'>".$str."</div>";
}
function err_sql($str){
echo "<div class='err'>".$str."</div>";
}
function chek($str)
{
$str = htmlentities(trim($str), ENT_QUOTES, 'UTF-8');
$str = nl2br($str);
$str = strtr($str, array(
chr(0) => '',
chr(1) => '',
chr(2) => '',
chr(3) => '',
chr(4) => '',
chr(5) => '',
chr(6) => '',
chr(7) => '',
chr(8) => '',
chr(9) => '',
chr(10) => '',
chr(11) => '',
chr(12) => '',
chr(13) => '',
chr(14) => '',
chr(15) => '',
chr(16) => '',
chr(17) => '',
chr(18) => '',
chr(19) => '',
chr(20) => '',
chr(21) => '',
chr(22) => '',
chr(23) => '',
chr(24) => '',
chr(25) => '',
chr(26) => '',
chr(27) => '',
chr(28) => '',
chr(29) => '',
chr(30) => '',
chr(31) => ''
));
$str = str_replace("'", "'", $str);
$str = str_replace('\', "\", $str);
$str = str_replace("|", "I", $str);
$str = str_replace("||", "I", $str);
$str = str_replace("/\$/", "$", $str);
$str = mysql_real_escape_string($str);
return $str;
}
function str_pages($base_url, $start, $max_value, $num_per_page) {
////////////////////////////////////////////////////////////
// Функция постраничной навигации //
////////////////////////////////////////////////////////////
// За основу взята аналогичная функция от форума SMF2.0 //
////////////////////////////////////////////////////////////
$pgcont = 4;
$pgcont = (int)($pgcont - ($pgcont % 2)) / 2;
if ($start >= $max_value)
$start = max(0, (int)$max_value - (((int)$max_value % (int)$num_per_page) == 0 ? $num_per_page : ((int)$max_value % (int)$num_per_page)));
else
$start = max(0, (int)$start - ((int)$start % (int)$num_per_page));
$base_link = '<a class="navpg" href="' . strtr($base_url, array ('%' => '%%')) . 'start=%d' . '">%s</a> ';
$pageindex = $start == 0 ? '' : sprintf($base_link, $start - $num_per_page, '<-');
if ($start > $num_per_page * $pgcont)
$pageindex .= sprintf($base_link, 0, '1');
if ($start > $num_per_page * ($pgcont + 1))
$pageindex .= '<span style="font-weight: bold;"> ... </span>';
for ($nCont = $pgcont; $nCont >= 1; $nCont--)
if ($start >= $num_per_page * $nCont) {
$tmpStart = $start - $num_per_page * $nCont;
$pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}
$pageindex .= '[<b>' . ($start / $num_per_page + 1) . '</b>] ';
$tmpMaxPages = (int)(($max_value - 1) / $num_per_page) * $num_per_page;
for ($nCont = 1; $nCont <= $pgcont; $nCont++)
if ($start + $num_per_page * $nCont <= $tmpMaxPages) {
$tmpStart = $start + $num_per_page * $nCont;
$pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}
if ($start + $num_per_page * ($pgcont + 1) < $tmpMaxPages)
$pageindex .= '<span style="font-weight: bold;"> ... </span>';
if ($start + $num_per_page * $pgcont < $tmpMaxPages)
$pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1);
if ($start + $num_per_page < $max_value) {
$display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page);
$pageindex .= sprintf($base_link, $display_page, '->');
}
return $pageindex;
}
$page = isset ($_REQUEST['page']) && $_REQUEST['page'] > 0 ? intval($_REQUEST['page']) : 1;
$start = isset ($_GET['start']) ? abs(intval($_GET['start'])) : 0;
$start = isset ($_REQUEST['page']) ? $page * $kmess - $kmess : $start;
?>