Просмотр файла katalog2/config.php

Размер файла: 3.81Kb
<?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
$px="kat_";
//в Ў«Ёж  б ࠬЁ
$utable = "users";
//Ј« ў­ п бва ­Ёж  б ©в 
$index="../index.php";
//ў и  Ї®«­ п ббл«Є  ­  б ©в, в.Ґ. ᮠ᫥襬 ў Є®­жҐ Ё«Ё б Ј« ў­л¬ д ©«®¬
$site="http://mobilka.us/";
//¬ ббЁў бЁ¬ў®«®ў
$rus = array(
"Рђ"=>"Ђ","Р°"=>" ","Р‘"=>"Ѓ","Р±"=>"Ў",
"Р’"=>"‚","РІ"=>"ў","Р“"=>"ѓ","Рі"=>"Ј",
"Р”"=>"„","Рґ"=>"¤","Р•"=>"…","Рµ"=>"Ґ",
"РЃ"=>"р","Р–"=>"†","Р¶"=>"¦","Р—"=>"‡",
"Р·"=>"§","Р?"=>"€","Рё"=>"Ё","Р™"=>"‰",
"Р№"=>"©","Рљ"=>"Љ","Рє"=>"Є","Р›"=>"‹",
"Р»"=>"«","Рњ"=>"Њ","Рј"=>"¬","Рќ"=>"Ќ",
"РЅ"=>"­","Рћ"=>"Ћ","Рѕ"=>"®","Рџ"=>"Џ",
"Рї"=>"Ї","Р "=>"ђ","СЂ"=>"а","РЎ"=>"‘",
"СЃ"=>"б","Рў"=>"’","С‚"=>"в","РЈ"=>"“",
"Сѓ"=>"г","Р¤"=>"”","С„"=>"д","РҐ"=>"•",
"С…"=>"е","Р¦"=>"–","С†"=>"ж","Р§"=>"—",
"С‡"=>"з","РЁ"=>"?","С€"=>"и","Р©"=>"™",
"С‰"=>"й","РЄ"=>"љ","СЉ"=>"к","Р«"=>"›",
"С‹"=>"л","Р¬"=>"њ","СЊ"=>"м","Р­"=>"ќ",
"СЌ"=>"н","Р®"=>"ћ","СЋ"=>"о","РЇ"=>"џ",
"СЏ"=>"п","С‘"=>"с"
);
//дг­ЄжЁп ЇҐаҐў®¤  ­  агббЄЁ© п§лЄ Ё§ о­ЁЄ®¤ 
function cyr($cyr_str) {
global $rus;
return strtr($cyr_str,$rus);
}
//ᮧ¤ Ґ¬ ¬ ббЁў § ¬Ґ­л бЁ¬ў®«®ў
  $tr = array(
   "Ђ"=>"Рђ"," "=>"Р°","Ѓ"=>"Р‘","Ў"=>"Р±","‚"=>"Р’",
   "ў"=>"РІ","ѓ"=>"Р“","Ј"=>"Рі","„"=>"Р”","¤"=>"Рґ",
   "…"=>"Р•","Ґ"=>"Рµ","р"=>"РЃ","†"=>"Р–","¦"=>"Р¶",
   "‡"=>"Р—","§"=>"Р·","€"=>"Р?","Ё"=>"Рё","‰"=>"Р™",
   "©"=>"Р№","Љ"=>"Рљ","Є"=>"Рє","‹"=>"Р›","«"=>"Р»",
   "Њ"=>"Рњ","¬"=>"Рј","Ќ"=>"Рќ","­"=>"РЅ","Ћ"=>"Рћ",
   "®"=>"Рѕ","Џ"=>"Рџ","Ї"=>"Рї","ђ"=>"Р ","а"=>"СЂ",
   "‘"=>"РЎ","б"=>"СЃ","’"=>"Рў","в"=>"С‚","“"=>"РЈ",
   "г"=>"Сѓ","”"=>"Р¤","д"=>"С„","•"=>"РҐ","е"=>"С…",
   "–"=>"Р¦","ж"=>"С†","—"=>"Р§","з"=>"С‡","?"=>"РЁ",
   "и"=>"С€","™"=>"Р©","й"=>"С‰","љ"=>"РЄ","к"=>"СЉ",
   "›"=>"Р«","л"=>"С‹","њ"=>"Р¬","м"=>"СЊ","ќ"=>"Р­",
   "н"=>"СЌ","ћ"=>"Р®","о"=>"СЋ","џ"=>"РЇ","п"=>"СЏ",
   "с"=>"С‘"
  );
//дг­ЄжЁп, ¤«п ЇҐаҐў®¤  ­  агббЄЁ©
  function utf($cyr_str) {
   global $tr;
   return strtr($cyr_str,$tr);
  }
//ЇаЁ¬Ґ­Ёвм нвг дг­ЄжЁо Є ⥪бвг ў бЄаЁЇвҐ
ob_start("utf");
//ўлў®¤ ¤ ­­ле Ё§ Є в «®Ј 
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=5;
//ўлбзЁвлў Ґ¬ ўбҐЈ® бва ­Ёж
$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 "<small><b><a href=\"out.php?link=".$data['link']."\">".$data['title']."</a></b><br/>";
print "<u>ЋЇЁб ­ЁҐ</u>: ".$data['about']."<br/>";
print "<u>Џа®Ј®«®б®ў «Ё</u>: ".$data['counter']."<br/>";
print "<u>ЏҐаҐе®¤®ў ᥣ®¤­п</u>: ".$data['outcounter']."<br/>";
print "<u>ЏҐаҐе®¤®ў ўбҐЈ®</u>: ".$data['alloutcounter']."</small><br/>";
}
//Є®¤ ¤«п ўлў®¤  ббл«®Є ­  ¤агЈЁҐ бва ­Ёжл ¤ ­­®© Є вҐЈ®аЁЁ
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&amp;page=$page_number\">[".($i+1)."]</a></small>";
} else {
print "<small><b>[".($i+1)."]</b></small>"; }
}
}
?>