<?php
$DB_HOST = "localhost"; //е®бв а бЇ®«®¦ҐЁп Ў §л ¤ ле
$DB_USER = "starwa_starwap"; //Ё¬п Ї®«м§®ў вҐ«п Ў §л
$DB_PASS = "ff6w73jj19gs"; //Ї а®«м Ї®«м§®ў ⥫п
$DB_NAME = "starwa_katt"; // §ў ЁҐ Ў §л
//гбв ў«Ёў Ґ¬ ᮥ¤ЁҐЁҐ
mysql_connect($DB_HOST,$DB_USER,$DB_PASS) or die (mysql_error());
//ўлЎЁа Ґ¬ Ў §г ¤«п а Ў®вл
mysql_select_db($DB_NAME);
//ЇаҐдЁЄб ¤«п в Ў«Ёж, ЇҐаҐ¬Ґ п $px
$px="kat_";
//в Ў«Ёж б о§Ґа ¬Ё
$utable = "users";
//Ј« ў п бва Ёж б ©в
$index="http://starwap.ru/index.php";
//ў и Ї®« п ббл«Є б ©в, в.Ґ. ᮠ᫥襬 ў Є®жҐ Ё«Ё б Ј« ўл¬ д ©«®¬
$site="http://starwap.ru/";
//¬ ббЁў бЁ¬ў®«®ў
$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).")"; }
}
}
?>