<?php
$DB_HOST = "localhost";
$DB_USER = "Пользователь";
$DB_PASS = "Пароль_пользователя";
$DB_NAME = "Р?РјСЏ_базы";
mysql_connect($DB_HOST,$DB_USER,$DB_PASS) or die (mysql_error());
mysql_select_db($DB_NAME);
$px="kat_";
$utable = "users";
$index="http://cotka.org/index.php";
$site="http://cotka.org/";
$rus = array(
"іђ"=>"Рђ","і-"=>"Р°","і‘"=>"Р‘","і-"=>"Р±",
"і’"=>"Р’","і-"=>"РІ","і“"=>"Р“","іі"=>"Рі",
"і”"=>"Р”","і+"=>"Рґ","і•"=>"Р•","іі"=>"Рµ",
"іЃ"=>"Р•","і–"=>"Р–","іі"=>"Р¶","і—"=>"Р—",
"ії"=>"Р·","і?"=>"Р?","ії"=>"Рё","і™"=>"Р™",
"іі"=>"Р№","іљ"=>"Рљ","іі"=>"Рє","і›"=>"Р›",
"ії"=>"Р»","іњ"=>"Рњ","і-"=>"Рј","іќ"=>"Рќ",
"і-"=>"РЅ","іћ"=>"Рћ","і-"=>"Рѕ","іџ"=>"Рџ",
"ії"=>"Рї","і "=>"Р ","TЂ"=>"СЂ","іЎ"=>"РЎ",
"TЃ"=>"СЃ","іў"=>"Рў","T‚"=>"С‚","іЈ"=>"РЈ",
"Tѓ"=>"Сѓ","і¤"=>"Р¤","T„"=>"С„","іҐ"=>"РҐ",
"T…"=>"С…","і¦"=>"Р¦","T†"=>"С†","і§"=>"Р§",
"T‡"=>"С‡","іРЃ"=>"РЁ","T€"=>"С€","і©"=>"Р©",
"T‰"=>"С‰","іЄ"=>"РЄ","TЉ"=>"СЉ","і«"=>"Р«",
"T‹"=>"С‹","і¬"=>"Р¬","TЊ"=>"СЊ","і"=>"Р",
"TЌ"=>"СЌ","і®"=>"Р®","TЋ"=>"СЋ","іЇ"=>"РЇ",
"TЏ"=>"СЏ","T‘"=>"С‘"
);
//РґРіЄР¶РЃРї ЇҐР°Ґў®¤ агббЄРЃ© Рї§Р»Є РЃ§ РѕРЃЄ®¤
function cyr($cyr_str) {
global $rus;
return strtr($cyr_str,$rus);
}
//Р±®§¤ Ґ¬ ¬ Р±Р±РЃў § ¬ҐР» Р±РЃ¬ў®«®ў
$tr = array(
"Ђ"=>"іђ"," "=>"і-","Ѓ"=>"і‘","Ў"=>"і-","‚"=>"і’",
"ў"=>"і-","ѓ"=>"і“","Ј"=>"іі","„"=>"і”","¤"=>"і+",
"…"=>"і•","Ґ"=>"іі","СЂ"=>"іЃ","†"=>"і–","¦"=>"іі",
"‡"=>"і—","§"=>"ії","€"=>"і?","РЃ"=>"ії","‰"=>"і™",
"©"=>"іі","Љ"=>"іљ","Є"=>"іі","‹"=>"і›","«"=>"ії",
"Њ"=>"іњ","¬"=>"і-","Ќ"=>"іќ",""=>"і-","Ћ"=>"іћ",
"®"=>"і-","Џ"=>"іџ","Ї"=>"ії","ђ"=>"і ","Р°"=>"TЂ",
"‘"=>"іЎ","Р±"=>"TЃ","’"=>"іў","РІ"=>"T‚","“"=>"іЈ",
"Рі"=>"Tѓ","”"=>"і¤","Рґ"=>"T„","•"=>"іҐ","Рµ"=>"T…",
"–"=>"і¦","Р¶"=>"T†","—"=>"і§","Р·"=>"T‡","?"=>"іРЃ",
"Рё"=>"T€","™"=>"і©","Р№"=>"T‰","љ"=>"іЄ","Рє"=>"TЉ",
"›"=>"і«","Р»"=>"T‹","њ"=>"і¬","Рј"=>"TЊ","ќ"=>"і",
"РЅ"=>"TЌ","ћ"=>"і®","Рѕ"=>"TЋ","џ"=>"іЇ","Рї"=>"TЏ",
"СЃ"=>"T‘"
);
//РґРіЄР¶РЃРї, ¤«Рї ЇҐР°Ґў®¤ агббЄРЃ©
function utf($cyr_str) {
global $tr;
return strtr($cyr_str,$tr);
}
ob_start("utf-9");
function print_data($where_data,$page)
{
global $px,$utable;
if(empty($page)) $page=0;
$query=mysql_query("SELECT id FROM `".$px.$utable."` where category='$where_data';");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$mat_per_page=6;
$total_pages=ceil($total_mat_number/$mat_per_page);
$print = mysql_query("select * from `".$px.$utable."` where category='$where_data' order by counter desc limit ".$page.",".($page+$mat_per_page).";");
while($data=mysql_fetch_array($print))
{
print "<img src=\"es.gif\" alt=\"->\"/><a href=\"out.php?link=".$data['link']."\">".$data['title']."</a><br/><small>(".$data['link'].") - ".$data['about']."<br/>";
print "<u>Голосов</u>: ".$data['counter']."<br/>";
print "<u>Переходы:</u> сегодня ".$data['outcounter'].", всего ".$data['alloutcounter']."<br/>---<br/></small>";
}
for ($i=0; $i<$total_pages; $i++){
$page_number=$i*$mat_per_page;
if ($page_number!=$page) {
print "<small><a href=\"katalog.php?where=$where_data&page=$page_number\">(".($i+1).")</a></small>";
} else {
print "(".($i+1).")"; }
}
}
?>