<?
ob_start("rus");
$admin = "[email protected]";
$autor= array("Wap",$admin,"admin");
$nums = 3; // количество сообшений на странице
$adminka="No";
if (!empty($nm)) if ($nm==$autor[0])
if (!empty($ml)) if ($ml==$autor[1])
if (!empty($tx)) if ($tx==$autor[2])
{$adminka="Yes"; $nums = 1;}
if (($adminka=="Yes")&&(isset($ad))&&(isset($num))){
$ad= substr(zashita(trim($ad)),0, 500);
$fp = file("index.dat");
$total= count($fp);
$tuda= (int)$fp[$total-$num-1];
$fp[$total-$num-1]= substr("0000000".filesize("gostev.dat"), -7).chr(13).chr(10);
$mas=false;
foreach($fp as $a) $mas[]=trim($a);
saveserg("index.dat",$mas); // тут происходит изменение файла индексов так как админ дал ответ
$fp = fopen ("index.dat", "a+"); // это новый обнаруженный глюк после добавления сообщений
fputs($fp, chr(13).chr(10));
fclose($fp);
$fp= fopen("gostev.dat", "r");
fseek ($fp,$tuda, SEEK_SET);
$p = fgets($fp);
fclose($fp);
list($data,$name,$mail,$text,$answer)=explode("#|#",$p);
$fp = fopen("gostev.dat", "a+");
fputs($fp, "$data#|#$name#|#$mail#|#$text#|#$ad#|#".chr(13).chr(10));
fclose($fp);
}
if ($adminka=="No"){
if (empty($ml)) $ml=" ";
if (!empty($tx)) $go="add";
if (!empty($nm)) {
$go="add";
if (!empty($tx)) $go="rec";
}}
if ($adminka=="Yes") if (!empty($go)) if ($go=="del") if(isset($num)) {
$filename="index.dat";
if (!file_exists($filename))
{
$fp = fopen($filename, "w");
fclose($fp);
}
$fp = file($filename);
$total=count($fp);
$fp[($total-$num-1)]=false;
$mas=false;
foreach($fp as $a)if ($a<>false) $mas[]=trim($a);
if ($mas==false){
$fp = fopen($filename, "w");
fclose($fp);
}else {
saveserg($filename,$mas);
$fp = fopen ("index.dat", "a+"); // это новый обнаруженный глюк после удаления сообщений
fputs($fp, chr(13).chr(10));
fclose($fp);
}
$go=" ";
}
if (empty($go)) $go=" ";
$er1=0;
$er2=0;
if ($go=="rec"){
$tx= zashita($tx);
$nm= zashita($nm);
$tx=substr(trim($tx),0, 500);
$nm=substr(trim($nm),0, 10);
$ml=substr(trim($ml),0, 32);
if ((count(explode(" ",$ml)))>1) {$go="add"; $er1=1;}
if (!(validEmail($ml))) {$go="add"; $er2=1;}
if ($go!="add"){
// проверка на наличие такого сообщения
$ret= 1;
$filename="linego.dat";
if (!file_exists($filename))
{
$fp = fopen($filename, "w");
fclose($fp);
}
$fp = file($filename);
$a= $nm.$ml.$tx;
$massiv[]=$a."#||#".time();
foreach ($fp as $p) {
$znach= explode("#||#",$p);
if (($znach[1]+600) > time()) $massiv[]=rtrim($p);
if ($znach[0]==$a) $ret= 0;
}
saveserg($filename,$massiv);
if ($ret==1) {
// проверка окончена
$fp = fopen ("index.dat", "a+");
fputs($fp, substr("0000000".filesize("gostev.dat"), -7).chr(13).chr(10));
fclose($fp);
$fp = fopen("gostev.dat", "a+");
fputs($fp, strftime("%d.%m.%y %H:%M#|#")."$nm#|#$ml#|#$tx#|##|#".chr(13).chr(10));
fclose($fp);
}else $go=" ";
}
}
if ($go!="add"){
$num2 = $nums;
$filename="gostev.dat";
if (!file_exists($filename))
{
$fp = fopen($filename, "w");
fclose($fp);
}
$filename="index.dat";
if (!file_exists($filename))
{
$fp = fopen($filename, "w");
fclose($fp);
}
$fp = file($filename);
$total=count($fp);
if (empty($total)) $s="Гостевая книга пуста.";
else $s="Всего сообщений: $total";
header("Content-Type: text/vnd.wap.wml; charset=UTF-8");
print '<?xml version="1.0"?>';
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Гостевая"<? if ($go=="rec") print ' newcontext="true"' ?>>
<p align="center">
<table columns="1">
<tr>
<td>
<b>
<?print $admin;?>
</b>
</td>
</tr>
<tr>
<td>
<?print $s;?>
</td>
</tr>
</table>
<?if ($go=="rec") print "Сообшение успешно добавлено.<br/>";
?>
</p>
<?
if (!empty($total)) {
if(empty($num)) $num=0;
if ($num>($total-1)) $num=$total-1;
$num=abs($num);
$fp = array_reverse($fp);
$s=false;
for($i=$num; $i<min($num+$nums,$total); $i++) $s[]=(int)$fp[$i];
$fp= fopen("gostev.dat", "r");
$p=false;
foreach($s as $i){
fseek ($fp,$i, SEEK_SET);
$p[] = fgets($fp);
}
fclose($fp);
$er1=0;
foreach ($p as $i){
list($data,$name,$mail,$text,$answer)=explode("#|#",$i);
?>
<p>
<table columns="1">
<tr>
<td>
<?=htmlspecialchars($data)." -".($total-$num-$er1)."-"?>
</td>
</tr>
<tr>
<td>
<b>
Name:
</b>
<?=(dollar(htmlspecialchars($name)))?>
<br/>
<?
$er1++;
if (!empty($mail)){
?>
<b>
E-mail:
</b>
<?
if ($adminka<>"Yes"){
print htmlspecialchars($mail);
}else{
?>
<a href="../mail.php?<? print rand(0,100000)."&m_t=".htmlspecialchars($mail)."&m_r=gostev/?go=add%26num=$num";?>">
<?print htmlspecialchars($mail);?>
</a>
<?}
?>
<br/>
<?
}
?>
<b>
Text:
</b>
<?=(http($text));
if (!empty($answer)){
?>
<br/>
<b>
Admin:
</b>
<?=(http($answer))?>
<?
}
?>
</td>
</tr>
</table>
<?
if (($adminka=="Yes")&&($go=="ans")){
?>
<input name="data" title="Ответ Админа" emptyok="true" type="text" value="" maxlength="500"/>
</p><p>
<anchor>
Send
<go method="post" href="<? print $PHP_SELF."?p=".rand(0,100000)."&num=$num"?>">
<postfield name="nm" value="<?=htmlspecialchars($nm)?>"/>
<postfield name="ml" value="<?=htmlspecialchars($ml)?>"/>
<postfield name="tx" value="<?=htmlspecialchars($tx)?>"/>
<postfield name="ad" value="$(data)"/>
</go>
</anchor>
<?
}else{
if ($adminka=="Yes"){
?>
<anchor>
Delete
<go method="post" href="<? print $PHP_SELF."?p=".rand(0,100000)."&go=del&num=$num"?>">
<postfield name="nm" value="<?=htmlspecialchars($nm)?>"/>
<postfield name="ml" value="<?=htmlspecialchars($ml)?>"/>
<postfield name="tx" value="<?=htmlspecialchars($tx)?>"/>
</go>
</anchor>
<anchor>
Answer
<go method="post" href="<? print $PHP_SELF."?p=".rand(0,100000)."&go=ans&num=$num"?>">
<postfield name="nm" value="<?=htmlspecialchars($nm)?>"/>
<postfield name="ml" value="<?=htmlspecialchars($ml)?>"/>
<postfield name="tx" value="<?=htmlspecialchars($tx)?>"/>
</go>
</anchor>
<anchor>
Next
<go method="post" href="<? print $PHP_SELF."?p=".rand(0,100000)."&go=nex&num=".($num+1)?>">
<postfield name="nm" value="<?=htmlspecialchars($nm)?>"/>
<postfield name="ml" value="<?=htmlspecialchars($ml)?>"/>
<postfield name="tx" value="<?=htmlspecialchars($tx)?>"/>
</go>
</anchor>
<a href="<? print $PHP_SELF."?p=".rand(0,100000)?>">
Exit
</a>
<?
}}
print '</p>';
}
//навигация
$page_next = $num + $nums;
$page_prev = $num - $nums;
$page_next1 = $num + ($nums + $num2);
$page_prev1 = $num - ($nums + $num2);
$num3 = $total - $num2;
$p=ceil($page_next/$nums);
$d=abs($p+1);
$dd=abs($d+1);
$n=abs($p-1);
$nn=abs($n-1);
if ($adminka=="No"){
?>
<p>
стр.
<?
if ($num > $num2){
?>
<a href="<? print $PHP_SELF."?p=".rand(0,100000)."&num=$page_prev1".'">'.$nn;?>
</a>
<?
}
if ($num >=$nums){
?>
<a href="<? print $PHP_SELF."?p=".rand(0,100000)."&num=$page_prev".'">'.$n;?>
</a>
←
<?
}
echo "<b>$p</b>";
if (($num + $nums) < $total){
?>
→
<a href="<? print $PHP_SELF."?p=".rand(0,100000)."&num=$page_next".'">'.$d;?>
</a>
<?
}
if (($num + $num2) < $num3){
?>
<a href="<? print $PHP_SELF."?p=".rand(0,100000)."&num=$page_next1".'">'.$dd;?>
</a>
<?
}
?>
</p>
<?
}}
?>
<p align="center">
***
</p>
<?if ($adminka<>"Yes"){ ?>
<p align="center">
<a href="<? print $PHP_SELF."?p=".rand(0,100000)."&go=add"; if (!empty($num)) print "&num=$num";?>">
Добавить сообщение
</a>
</p>
<?}?>
<p>
<a href="../<? print "?p=".rand(0,100000); ?>">
На главную © <?print getenv('SERVER_NAME');?>
</a>
</p>
</card>
</wml>
<?
}else{
header("Content-Type: text/vnd.wap.wml; charset=UTF-8");
print '<?xml version="1.0"?>';
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Новое сообщение">
<p align="center">
<table columns="1">
<tr>
<td>
<b>
<?print $admin;?>
</b>
</td>
</tr>
<tr>
<td>
<?print strftime("%d.%m.%y %H:%M")?>
</td>
</tr>
</table>
</p>
<p align="center">
Name:
<br/>
<?
if (!empty($tx)) if (empty($nm)) print "Введите этот обязательный параметр<br/>";
?>
<input name="name" emptyok="true" title="Обязательно" type="text" <? if (!empty($nm)) print 'value="'.(zashita(htmlspecialchars($nm))).'"'?> maxlength="10"/>
</p>
<p align="center">
Mail:
<br/>
<?
if ($er1==1) print "Пробелы не нужны<br/>";
if ($er2==1) print "Адрес должен быть [email protected]<br/>";
?>
<input name="mail" emptyok="true" title="По желанию" type="text" value="" maxlength="32"/>
</p>
<p align="center">
Text:
<br/>
<a href="smview.php<?="?p=".rand(0,100000)?>">
Список смайлов
</a>
<br/>
<?
if (!empty($nm)) if (empty($tx)) print "Введите этот обязательный параметр<br/>";
?>
<input name="text" emptyok="true" title="Обязательно" type="text" <? if (!empty($tx)) print 'value="'.(zashita(htmlspecialchars($tx))).'"'?> maxlength="500"/>
</p>
<p align="center">
<anchor>
Добавить
<go method="post" href="<? print $PHP_SELF."?p=".rand(0,100000); if (!empty($num)) print "&num=$num"; ?>">
<postfield name="nm" value="$(name)"/>
<postfield name="ml" value="$(mail)"/>
<postfield name="tx" value="$(text)"/>
</go>
</anchor>
</p>
</card>
</wml>
<?
}
// конец кода WML ***********************************
ob_end_flush();
function validEmail($email) {
if (eregi("^[a-z0-9_]+([-_\.]?[a-z0-9_])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email))
return TRUE;
else
if (strlen($email)===0) return TRUE;
else return FALSE;
}
function saveserg($filename,$mas){
$a="";
foreach ($mas as $zn) $a.=$zn.chr(13).chr(10);
$fp = fopen($filename, "w");
fputs($fp, trim($a));
fclose($fp);
}
function http($a){
$mark="#+|+#";
$str=array($mark => "");
$a=strtr($a, $str); // вырезали на всякий случай
$a=" $a ";
$s="";
$razd=array("http://", "www.", "wap.");
$str=array(
" $razd[0]" => " $mark$razd[0]",
" $razd[1]" => " $mark$razd[1]",
" $razd[2]" => " $mark$razd[2]",
);
$a=strtr($a, $str);
//print "-$a-<br/>".(count(explode(" $mark", " $a"))-1);
$f=(count(explode(" $mark", " $a"))-1);
for ($i=1; $i<=$f;$i++) {
//print "-$i-<br/>";
// найдена ссылка
$t= strpos($a," $mark");
if (!empty($t)) $s.= smile(htmlspecialchars(substr($a,0,$t)));
$ssyl= substr($a,$t-strlen($a)+ strlen(" $mark"));
$a=strstr($ssyl," ");
if (!empty($a)) $s.= vydel(substr($ssyl,0,-strlen($a)));
}
print (zashita($s.smile(htmlspecialchars($a))));
}
function vydel($a){
$s=array("&"); // вдруг есть еще какие символы
$l=true;
foreach($s as $q){
$w=strtr($a,$q," ");
if (htmlspecialchars($w)!=$w) $l=false;
}
if ($l){
$fp= array_reverse(explode(" http://",strtolower(" $a")));
$s= htmlspecialchars(trim($fp[0]));
$a= '<a href="http://'.$s.'">'.htmlspecialchars($a).'</a>';
return " $a ";
}else return smile(htmlspecialchars($a));
}
function dollar($a){
$str=array("$" => "$$");
return strtr($a, $str);
}
function smile($s){
$s=str_replace(" .ulibka. "," <img src=\"smiles/biggrin.gif\" alt=\".ulibka.\"/> ",$s);
$s=str_replace(" .blush. "," <img src=\"smiles/blush.gif\" alt=\".blush.\"/> ",$s);
$s=str_replace(" .boggle. "," <img src=\"smiles/boggle.gif\" alt=\".boggle.\"/> ",$s);
$s=str_replace(" .confused. "," <img src=\"smiles/confused.gif\" alt=\".confused.\"/> ",$s);
$s=str_replace(" .cool. "," <img src=\"smiles/cool.gif\" alt=\".cool.\"/> ",$s);
$s=str_replace(" .eek. "," <img src=\"smiles/eek.gif\" alt=\".eek.\"/> ",$s);
$s=str_replace(" .huh. "," <img src=\"smiles/huh.gif\" alt=\".huh.\"/> ",$s);
$s=str_replace(" .inlove. "," <img src=\"smiles/inlove.gif\" alt=\".inlove.\"/> ",$s);
$s=str_replace(" .mad. "," <img src=\"smiles/mad.gif\" alt=\".mad.\"/> ",$s);
$s=str_replace(" .notsure. "," <img src=\"smiles/notsure.gif\" alt=\".notsure.\"/> ",$s);
$s=str_replace(" .ooh. "," <img src=\"smiles/ooh.gif\" alt=\".ooh.\"/> ",$s);
$s=str_replace(" .rolleyes. "," <img src=\"smiles/rolleyes.gif\" alt=\".rolleyes.\"/> ",$s);
$s=str_replace(" .sad. "," <img src=\"smiles/sad.gif\" alt=\".sad.\"/> ",$s);
$s=str_replace(" .sleep. "," <img src=\"smiles/sleep.gif\" alt=\".sleep.\"/> ",$s);
$s=str_replace(" .smile. "," <img src=\"smiles/smile.gif\" alt=\".smile.\"/> ",$s);
$s=str_replace(" .stress. "," <img src=\"smiles/stress.gif\" alt=\".stress.\"/> ",$s);
$s=str_replace(" .tired. "," <img src=\"smiles/tired.gif\" alt=\".tired.\"/> ",$s);
$s=str_replace(" .tongue. "," <img src=\"smiles/tongue.gif\" alt=\".tongue.\"/> ",$s);
$s=str_replace(" .urgh. "," <img src=\"smiles/urgh.gif\" alt=\".urgh.\"/> ",$s);
$s=str_replace(" .wink. "," <img src=\"smiles/wink.gif\" alt=\".wink.\"/> ",$s);
$s=str_replace(" .worry. "," <img src=\"smiles/worry.gif\" alt=\".worry.\"/> ",$s);
$s=str_replace(" .vopros. "," <img src=\"smiles/vopros.gif\" alt=\".vopros.\"/> ",$s);
$s=str_replace(" .pivo. "," <img src=\"smiles/pivo.gif\" alt=\".pivo.\"/> ",$s);
$s=str_replace(" .be. "," <img src=\"smiles/be.gif\" alt=\".be.\"/> ",$s);
$s=str_replace(" .bumbum. "," <img src=\"smiles/bumbum.gif\" alt=\".bumbum.\"/> ",$s);
$s=str_replace(" .eat. "," <img src=\"smiles/eat.gif\" alt=\".eat.\"/> ",$s);
$s=str_replace(" .sleza. "," <img src=\"smiles/sleza.gif\" alt=\".sleza.\"/> ",$s);
$s=str_replace(" .chmok. "," <img src=\"smiles/chmok.gif\" alt=\".chmok.\"/> ",$s);
$s=str_replace(" .ne.znayu. "," <img src=\"smiles/ne.znayu.gif\" alt=\".ne.znayu.\"/> ",$s);
$s=str_replace(" .jump. "," <img src=\"smiles/jump.gif\" alt=\".jump.\"/> ",$s);
$s=str_replace(" .good. "," <img src=\"smiles/good.gif\" alt=\".good.\"/> ",$s);
$s=str_replace(" .chmak. "," <img src=\"smiles/chmak.gif\" alt=\".chmak.\"/> ",$s);
$s=str_replace(" .clock. "," <img src=\"smiles/clock.gif\" alt=\".clock.\"/> ",$s);
$s=str_replace(" .zubastik. "," <img src=\"smiles/zubastik.gif\" alt=\".zubastik.\"/> ",$s);
$s=str_replace(" .warning. "," <img src=\"smiles/warning.gif\" alt=\".warning.\"/> ",$s);
$s=str_replace(" .zloi. "," <img src=\"smiles/zloi.gif\" alt=\".zloi.\"/> ",$s);
$s=str_replace(" .heart. "," <img src=\"smiles/heart.gif\" alt=\".heart.\"/> ",$s);
$s=str_replace(" .talk. "," <img src=\"smiles/talk.gif\" alt=\".talk.\"/> ",$s);
$s=str_replace(" .cvetok. "," <img src=\"smiles/cvetok.gif\" alt=\".cvetok.\"/> ",$s);
$s=str_replace(" .loveyou. "," <img src=\"smiles/love.you.gif\" alt=\".loveyou.\"/> ",$s);
$s=str_replace(" .kruzhka. "," <img src=\"smiles/kruzhka.gif\" alt=\".kruzhka.\"/> ",$s);
$s=str_replace(" .4mok. "," <img src=\"smiles/4mok.gif\" alt=\".4mok.\"/> ",$s);
$s=str_replace(" .love. "," <img src=\"smiles/love.gif\" alt=\".love.\"/> ",$s);
$s=str_replace(" .smoke. "," <img src=\"smiles/smoke.gif\" alt=\".smoke.\"/> ",$s);
return dollar($s);
}
function zashita($a){
$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) => "",
"#|#" => "",
" " => " ",
" " => " ",
chr(208).chr(144) => "А",
chr(208).chr(145) => "Б",
chr(208).chr(146) => "В",
chr(208).chr(147) => "Г",
chr(208).chr(148) => "Д",
chr(208).chr(149) => "Е",
chr(208).chr(129) => "Ё",
chr(208).chr(150) => "Ж",
chr(208).chr(151) => "З",
chr(208).chr(152) => "И",
chr(208).chr(153) => "Й",
chr(208).chr(154) => "К",
chr(208).chr(155) => "Л",
chr(208).chr(156) => "М",
chr(208).chr(157) => "Н",
chr(208).chr(158) => "О",
chr(208).chr(159) => "П",
chr(208).chr(160) => "Р",
chr(208).chr(161) => "С",
chr(208).chr(162) => "Т",
chr(208).chr(163) => "У",
chr(208).chr(164) => "Ф",
chr(208).chr(165) => "Х",
chr(208).chr(166) => "Ц",
chr(208).chr(167) => "Ч",
chr(208).chr(168) => "Ш",
chr(208).chr(169) => "Щ",
chr(208).chr(170) => "Ъ",
chr(208).chr(171) => "Ы",
chr(208).chr(172) => "Ь",
chr(208).chr(173) => "Э",
chr(208).chr(174) => "Ю",
chr(208).chr(175) => "Я",
chr(208).chr(176) => "а",
chr(208).chr(177) => "б",
chr(208).chr(178) => "в",
chr(208).chr(179) => "г",
chr(208).chr(180) => "д",
chr(208).chr(181) => "е",
chr(209).chr(145) => "ё",
chr(208).chr(182) => "ж",
chr(208).chr(183) => "з",
chr(208).chr(184) => "и",
chr(208).chr(185) => "й",
chr(208).chr(186) => "к",
chr(208).chr(187) => "л",
chr(208).chr(188) => "м",
chr(208).chr(189) => "н",
chr(208).chr(190) => "о",
chr(208).chr(191) => "п",
chr(209).chr(128) => "р",
chr(209).chr(129) => "с",
chr(209).chr(130) => "т",
chr(209).chr(131) => "у",
chr(209).chr(132) => "ф",
chr(209).chr(133) => "х",
chr(209).chr(134) => "ц",
chr(209).chr(135) => "ч",
chr(209).chr(136) => "ш",
chr(209).chr(137) => "щ",
chr(209).chr(138) => "ъ",
chr(209).chr(139) => "ы",
chr(209).chr(140) => "ь",
chr(209).chr(141) => "э",
chr(209).chr(142) => "ю",
chr(209).chr(143) => "я",
);
return stripslashes(strtr($a, $str));
}
function rus($a){
$change=array(
chr(10) => "",
chr(13) => "",
"А" => chr(208).chr(144) ,
"Б" => chr(208).chr(145) ,
"В" => chr(208).chr(146) ,
"Г" => chr(208).chr(147) ,
"Д" => chr(208).chr(148) ,
"Е" => chr(208).chr(149) ,
"Ё" => chr(208).chr(129) ,
"Ж" => chr(208).chr(150) ,
"З" => chr(208).chr(151) ,
"И" => chr(208).chr(152) ,
"Й" => chr(208).chr(153) ,
"К" => chr(208).chr(154) ,
"Л" => chr(208).chr(155) ,
"М" => chr(208).chr(156) ,
"Н" => chr(208).chr(157) ,
"О" => chr(208).chr(158) ,
"П" => chr(208).chr(159) ,
"Р" => chr(208).chr(160) ,
"С" => chr(208).chr(161) ,
"Т" => chr(208).chr(162) ,
"У" => chr(208).chr(163) ,
"Ф" => chr(208).chr(164) ,
"Х" => chr(208).chr(165) ,
"Ц" => chr(208).chr(166) ,
"Ч" => chr(208).chr(167) ,
"Ш" => chr(208).chr(168) ,
"Щ" => chr(208).chr(169) ,
"Ъ" => chr(208).chr(170) ,
"Ы" => chr(208).chr(171) ,
"Ь" => chr(208).chr(172) ,
"Э" => chr(208).chr(173) ,
"Ю" => chr(208).chr(174) ,
"Я" => chr(208).chr(175) ,
"а" => chr(208).chr(176) ,
"б" => chr(208).chr(177) ,
"в" => chr(208).chr(178) ,
"г" => chr(208).chr(179) ,
"д" => chr(208).chr(180) ,
"е" => chr(208).chr(181) ,
"ё" => chr(209).chr(145) ,
"ж" => chr(208).chr(182) ,
"з" => chr(208).chr(183) ,
"и" => chr(208).chr(184) ,
"й" => chr(208).chr(185) ,
"к" => chr(208).chr(186) ,
"л" => chr(208).chr(187) ,
"м" => chr(208).chr(188) ,
"н" => chr(208).chr(189) ,
"о" => chr(208).chr(190) ,
"п" => chr(208).chr(191) ,
"р" => chr(209).chr(128) ,
"с" => chr(209).chr(129) ,
"т" => chr(209).chr(130) ,
"у" => chr(209).chr(131) ,
"ф" => chr(209).chr(132) ,
"х" => chr(209).chr(133) ,
"ц" => chr(209).chr(134) ,
"ч" => chr(209).chr(135) ,
"ш" => chr(209).chr(136) ,
"щ" => chr(209).chr(137) ,
"ъ" => chr(209).chr(138) ,
"ы" => chr(209).chr(139) ,
"ь" => chr(209).chr(140) ,
"э" => chr(209).chr(141) ,
"ю" => chr(209).chr(142) ,
"я" => chr(209).chr(143) ,
chr(128) => "Ђ",
chr(129) => "Ѓ",
chr(130) => "‚",
chr(131) => "ѓ",
chr(132) => "„",
chr(133) => "…",
chr(134) => "†",
chr(135) => "‡",
chr(136) => "€",
chr(137) => "‰",
chr(138) => "Љ",
chr(139) => "‹",
chr(140) => "Њ",
chr(141) => "Ќ",
chr(142) => "Ћ",
chr(143) => "Џ",
chr(144) => "ђ",
chr(145) => "‘",
chr(146) => "’",
chr(147) => "“",
chr(148) => "”",
chr(149) => "•",
chr(150) => "-", // "–",
chr(151) => "-", // "—",
chr(153) => "™",
chr(154) => "љ",
chr(155) => "›",
chr(156) => "њ",
chr(157) => "ќ",
chr(158) => "ћ",
chr(159) => "џ",
chr(160) => " ",
chr(161) => "Ў",
chr(162) => "ў",
chr(163) => "Ј",
chr(164) => "¤",
chr(165) => "Ґ",
chr(166) => "¦",
chr(167) => "§",
chr(169) => "©",
chr(170) => "Є",
chr(171) => "«",
chr(172) => "¬",
chr(173) => "­",
chr(174) => "®",
chr(175) => "Ї",
chr(176) => "°",
chr(177) => "±",
chr(178) => "І",
chr(179) => "і",
chr(180) => "ґ",
chr(181) => "µ",
chr(182) => "¶",
chr(183) => "·",
chr(185) => "№",
chr(186) => "є",
chr(187) => "»",
chr(188) => "ј",
chr(189) => "Ѕ",
chr(190) => "ѕ",
chr(191) => "ї",
" " => " ",
" " => " ",
);
return strtr($a, $change);
}