Просмотр файла katrinka.ru/guestbook/mylib.php

Размер файла: 39.2Kb
<?php

function rmvbadch($string)
{
 $st=iconv("UTF-8","KOI8-R", $string);
 return iconv("KOI8-R","UTF-8", $st);
}

function test_chars($string)
{

# $ok_char_eng = array ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
# $ok_char_rus = explode(":", ":б:в:ч:з:д:е:і:ц:ъ:й:к:л:м:н:о:п:р:т:у:ф:х:ж:и:г:ю:ы:э:я:щ:ш:ь:а:с:Б:В:Ч:З:Д:Е:Ј:Ц:Ъ:Й:К:Л:М:Н:О:П:Р:Т:У:Ф:Х:Ж:И:Г:Ю:Ы:Э:Я:Щ:Ш:Ь:А:С:");
# $ok_char_sym = array ('!','?','.',',','`','"','-','(',')','@','/','|','\\',':','_',';','+','&','%','*','=','<','>','$','[',']','{','}','~','^','#','\'',' ');
# $ok_char_num = array ('0','1','2','3','4','5','6','7','8','9');
# $ok_char_spc = array ('£','€','¥','¤','§','¡','¿');
 
 $sl=strlen($string);
 $string=iconv("UTF-8","KOI8-R", $string);
 $string=iconv("KOI8-R","UTF-8", $string);
 $sl1=strlen($string);

 if ($sl1==$sl) return 1; else return 0;

# if ($sl==0) return 0;
# for ($i=0; $i<$sl; $i++) {
#  $cok=0;
#  if ($string[$i]=='') return 0;
#  if (in_array($string[$i], $ok_char_eng)) $cok=1;
#  if (in_array($string[$i], $ok_char_rus)) $cok=1;
#  if (in_array($string[$i], $ok_char_sym)) $cok=1;
#  if (in_array($string[$i], $ok_char_num)) $cok=1;
#  if (in_array($string[$i], $ok_char_spc)) $cok=1;
#  if (!$cok) return 0;
# }
# if ($cok) return 1; else return 0;
}

function uauth($login,$pass)
{
	$agent=$_SERVER['HTTP_USER_AGENT'];
	$dbhost='dbserv.msfu.ru';
	$dbname='katwap';
	$dbport=5432;
	$dbuser='katrinka';
	$dbpass='password';
	if (($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
		$res=pg_query($conn,"select id from users where login='$login' and passwd='$pass' and moder=0;");
		if (pg_numrows($res)==1) {
			$id=pg_result($res,0,0);
			$timex=time();
			pg_query($conn,"update users set lastact='$timex',lastagent='$agent' where id='$id';");
			pg_close($conn);
			return $id;
		}
	} else { print "Error connecting to database!"; }
	pg_close($conn);
	return 0;
}

function check_op($addr)
{
	list ($ip1, $ip2, $ip3, $ip4) = split('\.',$addr);
#	if ($addr=='194.190.213.9') return array ('BeeLine',1);
	if (($addr=='217.118.66.232') || ($addr=='217.118.78.1')) {
		if (ereg("^Nokia6600.*",$_SERVER['HTTP_USER_AGENT']))
			return array ('BeeLine INET',1);
		if (ereg("^Nokia6230.*",$_SERVER['HTTP_USER_AGENT']))
			return array ('BeeLine INET',1);
		if (ereg("^Nokia7200.*",$_SERVER['HTTP_USER_AGENT']))
			return array ('BeeLine INET',1);
	}
#	if ($addr=='194.190.213.37') return array ('BeeLine',1);
    if ($addr=='217.118.84.19') return array ('BeeLine',1);
	if ($addr=='216.155.165.240') return array ('T-Mobile',1);
	if ($addr=='192.118.11.101') return array ('Orange',1);
	if ($addr=='212.150.203.39') return array ('Cellcom',1);
	if ($addr=='212.150.203.40') return array ('Cellcom',1);
	if ($addr=='212.44.140.186') return array ('MTS',1);
	if ($addr=='195.98.50.238') return array ('MTS1',1);
	if ($addr=='212.185.45.153') return array ('MTS leviy',1);
	if ($addr=='212.185.45.152') return array ('MTS leviy 2',1);
	if ($addr=='217.66.145.10') {
		if (isset($_SERVER['HTTP_X_WAP_NETWORK_CLIENT_IP'])) return array ('MTS Piter',1);
		else return array ('MTS Piter',0);
	}
	if ($addr=='130.244.196.92') return array ('SWIP',1);
	if ($addr=='195.98.32.115') return array ('MTS NN',1);
	if ($addr=='82.208.77.129') return array ('MTS NN',1);
	if ($addr=='213.177.97.130') return array ('MTS NN',1);
	if ($addr=='195.239.140.58') return array ('NWGSM',1);
	if ($addr=='217.107.160.34') return array ('BM Telecom UFA',1);
	if ($addr=='82.151.17.5') return array ('BashCell UFA',1);
	if ($addr=='193.201.231.2') return array ('Sonic Duo',1);
	if ($addr=='80.255.64.66') return array ('UMC',1);
	if ($addr=='213.226.131.132') return array ('Bite GSM',1);
	if ($addr=='195.239.160.13') return array ('KUBAN-GSM',1);
	if ($addr=='195.47.255.7') return array ('Kazakhtelecom',1);
	if ($addr=='212.98.161.170') return array ('Velcom',1);
	if ($addr=='213.135.102.202') return array ('Orenburg',1);
	if ($addr=='217.71.32.236') return array ('Estonian Mobile',1);
	if ($addr=='217.106.95.134') return array ('Mobicom Caucasus',1);
	if ($addr=='193.35.129.161') return array ('Orange PCS PLC',1);
	if ($addr=='194.129.183.60') return array ('MOB-E.Com',1);
	if ($addr=='217.77.165.33') return array ('OSKARMOBIL',1);
	if ($addr=='193.113.200.231') return array ('British Telecommunications',1);
	if ($addr=='194.237.106.73') return array ('Telianet',1);
	if ($addr=='213.226.131.133') return array ('BITE',1);
	if ($addr=='213.226.131.154') return array ('BITE',1);
#	if ($addr=='') return array ('',1);

	if ($addr=='212.188.14.1') return array ('SPNET',1);
	if ($addr=='213.234.246.147') return array ('SPNET',1);
	if ($addr=='212.30.181.127') return array ('SPNET',1);
	if ($addr=='212.188.14.9') return array ('SPNET',1);
	if ($addr=='213.137.227.34') return array ('SPNET',1);
	if ($addr=='213.137.244.34') return array ('SPNET',1);
	if ($addr=='193.233.62.4') return array ('MSFU',1);
	if ($addr=='217.8.227.179') return array ('SCS9000 novosib',1);
	if ($addr=='80.237.85.241') return array ('Megafon novosib',1);
	if ($addr=='193.201.231.126') return array ('Megafon INET',1);
	if ($addr=='195.239.140.38') return array ('Megafon SPB',1);

	if (($ip1=='194')&&($ip2=='204')&&($ip3=='2')) return array ('UNINET',1);

	if (($ip1=='212')&&($ip2=='93')&&($ip3=='96')) return array ('LMT',1);
	if (($ip1=='212')&&($ip2=='93')&&($ip3=='97')) return array ('LMT',1);
	if (($ip1=='212')&&($ip2=='93')&&($ip3=='98')) return array ('LMT',1);
	if (($ip1=='194')&&($ip2=='176')&&($ip3=='32')) return array ('OMNITEL',1);

	if (($ip1=='217')&&($ip2=='8')&&($ip3=='224')) return array ('SCS900 Novosibirsk',1);
#	if (($ip1=='217')&&($ip2=='66')&&($ip3=='145')) return array ('MTS Piter',1);

	return array ('Unknown',0);

}

function checkagent($agent)
{
	$addr=$_SERVER['REMOTE_ADDR'];
	if ($addr=='212.30.181.127') return 1;
	if ($addr=='213.234.246.147') return 1;
	if ($addr=='81.195.173.4') return 1;
	if ($addr=='213.137.227.34') return 1;
	if ($addr=='213.137.244.34') return 1;
	if (ereg("M3Gate.*",$agent)) return 0;
#	if (!isset($_SERVER['HTTP_WAP_CONNECTION'])) return 0;
	if (ereg(".*DeckIt.*",$agent)) return 0;
#	if (($addr=='194.190.213.37')&&(ereg("^EZOS.*",$agent))) return 1;
#	list ($ip1, $ip2, $ip3, $ip4) = split('\.',$addr);
	if (ereg("^QCI-.*",$agent)) return 1;
	if (ereg("^SAMSUNG-.*",$agent)) return 1;
	if (ereg("^SHARP-.*",$agent)) return 1;
	if (ereg("^Mitsu.*",$agent)) return 1;
#	if (!ereg("text/vnd.wap.wml",$_SERVER['HTTP_ACCEPT'])) return 0;
#	if (ereg("^Alcatel-BF5.*",$agent)) return 0;
	if ((ereg("^Nokia.*",$agent))||(ereg("^SonyEricsson.*",$agent))||(ereg("^SEC-.*",$agent))||(ereg("^SIE-.*",$agent))||(ereg("^Ericsson.*",$agent))||(ereg("^Alcatel-.*",$agent))||(ereg("^LG-.*",$agent))||(ereg("^Panasonic-.*",$agent))||(ereg("^MOT-.*",$agent))||(ereg("^R600.*",$agent))||(ereg("^Motorola-.*",$agent))||($addr=='213.137.227.50')||($addr=='193.233.62.4')) return 1; else return 0;
}

function uconv($str)
{
#	$fl=0;
#	$out='';
#	for ($t=0;$t<strlen($str);$t++) {
#		if (ord($str[$t])==0xd0) { $fl=1; continue; }
#		if (ord($str[$t])==0xd1) { $fl=2; continue; }
#
#	 	if ($fl==1) {
#			$buf=sprintf("&#x04%x;", ord($str[$t])-0x80);
#			$out=$out.$buf;
#			$fl=0;
#			continue;
#		}
#
#	 	if ($fl==2) {
#			$buf=sprintf("&#x04%x;", ord($str[$t])-0x40);
#			$out=$out.$buf;
#			$fl=0;
#			continue;
#		}
#
#	 	$buf=sprintf("%s", $str[$t]);
#		$out=$out.$buf;
#		$fl=0;
#	}
	return ereg_replace('\$','$$', $str);
}

function noemul()
{
  header("Content-type: text/vnd.wap.wml");
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.dtd">
<wml>
<?php if ($_GET['lang']=='eng') { ?>
<card id="NoSign" title="Sorry">
<p>
It's available only from Nokia mobile phones...
<?php } else { ?>
<card id="NoSign" title="&#x0418;&#x0437;&#x0432;&#x0438;&#x043D;&#x0438;&#x0442;&#x0435;">
<p>
&#x041D;&#x0435; &#x0443;&#x0434;&#x0430;&#x043B;&#x043E;&#x0441;&#x044C; &#x0443;&#x0441;&#x0442;&#x0430;&#x043D;&#x043E;&#x0432;&#x0438;&#x0442;&#x044C; &#x043C;&#x043E;&#x0434;&#x0435;&#x043B;&#x044C; &#x0432;&#x0430;&#x0448;&#x0435;&#x0433;&#x043E; &#x0442;&#x0435;&#x043B;&#x0435;&#x0444;&#x043E;&#x043D;&#x0430;<br/>
<?php } ?>
</p>
</card>
</wml>
<?php
}

function unk_op()
{
  header("Content-type: text/vnd.wap.wml");
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.dtd">
<wml>
<?php if ($_GET['lang']=='eng') { ?>
<card id="NoSign" title="Sorry">
<p>
Your mobile operator is unknown, please report this to our guestbook...
<?php } else { ?>
<card id="NoSign" title="&#x0418;&#x0437;&#x0432;&#x0438;&#x043D;&#x0438;&#x0442;&#x0435;">
<p>
&#x043D;&#x0435; &#x0443;&#x0434;&#x0430;&#x043B;&#x043E;&#x0441;&#x044C; &#x0443;&#x0441;&#x0442;&#x0430;&#x043D;&#x043E;&#x0432;&#x0438;&#x0442;&#x044C; &#x043D;&#x0430;&#x0437;&#x0432;&#x0430;&#x043D;&#x0438;&#x0435; &#x0432;&#x0430;&#x0448;&#x0435;&#x0433;&#x043E; &#x043E;&#x043F;&#x0435;&#x0440;&#x0430;&#x0442;&#x043E;&#x0440;&#x0430; &#x043C;&#x043E;&#x0431;&#x0438;&#x043B;&#x044C;&#x043D;&#x043E;&#x0439; &#x0441;&#x0432;&#x044F;&#x0437;&#x0438;. &#x041F;&#x043E;&#x0436;&#x0430;&#x043B;&#x0443;&#x0439;&#x0441;&#x0442;&#x0430;, &#x0441;&#x043E;&#x043E;&#x0431;&#x0449;&#x0438;&#x0442;&#x0435; &#x043D;&#x0430;&#x043C; &#x043E;&#x0431; &#x044D;&#x0442;&#x043E;&#x043C;.<br/>
<?php
}
print "IP: ".$_SERVER['REMOTE_ADDR']."<br/>\n";
?>
</p>
</card>
</wml>
<?php
}

function loginform($wh)
{
	print "Login: ";
	print "<input type=\"text\" name=\"login\" title=\"Login\" maxlength=\"15\"/><br/>\n";
	print "Password:\n";
	print "<input type=\"password\" name=\"pass\" title=\"Password\" maxlength=\"15\"/><br/>\n";
	switch ($wh) {
		case 1:
			print "<anchor title=\"Ok\">Ok<go href=\"user_pref.php\" method=\"post\">\n";
			break;
		default:
			print "<anchor title=\"Ok\">Ok<go href=\"login.php\" method=\"post\">\n";
	}
	print "<postfield name=\"login\" value=\"$(login)\"/>\n";
	print "<postfield name=\"pass\" value=\"$(pass)\"/>\n";
	print "<postfield name=\"lang\" value=\"".$_GET['lang']."\"/>\n";
	print "<postfield name=\"nc\" value=\"1\"/>\n";
	print "</go></anchor><br/>\n";
}

function wmlhd()
{ ?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.dtd">
<wml>
<card id="RegErr" title="Error">
<?php }

function color_phone($agent)
{
  if (ereg("^Mozilla.*",$agent)) return 1;
  if (ereg("^Opera.*",$agent)) return 1;
  if (ereg("^NokiaN-Gage.*",$agent)) return 1;
  if (ereg("^Nokia3100.*",$agent)) return 1;
  if (ereg("^Nokia3200.*",$agent)) return 1;
  if (ereg("^Nokia3300.*",$agent)) return 1;
  if (ereg("^Nokia3510i.*",$agent)) return 1;
  if (ereg("^Nokia3650.*",$agent)) return 1;
  if (ereg("^Nokia3660.*",$agent)) return 1;
  if (ereg("^Nokia5100.*",$agent)) return 1;
  if (ereg("^Nokia5140.*",$agent)) return 1;
  if (ereg("^Nokia6100.*",$agent)) return 1;
  if (ereg("^Nokia6220.*",$agent)) return 1;
  if (ereg("^Nokia6230.*",$agent)) return 1;
  if (ereg("^Nokia6600.*",$agent)) return 1;
  if (ereg("^Nokia6610.*",$agent)) return 1;
  if (ereg("^Nokia6650.*",$agent)) return 1;
  if (ereg("^Nokia6800.*",$agent)) return 1;
  if (ereg("^Nokia6810.*",$agent)) return 1;
  if (ereg("^Nokia6820.*",$agent)) return 1;
  if (ereg("^Nokia7210.*",$agent)) return 1;
  if (ereg("^Nokia7250.*",$agent)) return 1;
  if (ereg("^Nokia7250I.*",$agent)) return 1;
  if (ereg("^Nokia7600.*",$agent)) return 1;
  if (ereg("^Nokia7650.*",$agent)) return 1;
  if (ereg("^Nokia7700.*",$agent)) return 1;
  if (ereg("^Nokia8910i.*",$agent)) return 1;
  if (ereg("^SIE-M55.*",$agent)) return 1;
  if (ereg("^SIE-S55.*",$agent)) return 1;
  if (ereg("^SIE-SX1.*",$agent)) return 1;
  if (ereg("^LG-G7000.*",$agent)) return 1;
  if (ereg("^SonyEricssonP800.*",$agent)) return 1;
  if (ereg("^SonyEricssonT300.*",$agent)) return 1;
  if (ereg("^SonyEricssonT610.*",$agent)) return 1;
  if (ereg("^SonyEricssonT630.*",$agent)) return 1;
  if (ereg("^SonyEricssonZ600.*",$agent)) return 1;
  if (ereg("^SEC-SGHC100.*",$agent)) return 1;
  if (ereg("^MOT-T720.*",$agent)) return 1;
  if (ereg("^MOT-c350.*",$agent)) return 1;
  if (ereg("^Motorola-E365.*",$agent)) return 1;
  if (ereg("^Alcatel-BH4.*",$agent)) return 1;
  return 0;
}

function midi_access($agent)
{
  if (ereg("^SIE-.*",$agent)) return 1;
  if (ereg("^Alcatel-.*",$agent)) return 1;
  if (ereg("^MOT-.*",$agent)) return 1;
  if ((ereg("^Nokia3100.*",$agent))||(ereg("^Nokia3200.*",$agent))||(ereg("^Nokia3300.*",$agent))||(ereg("^Nokia3510.*",$agent))||(ereg("^Nokia6100.*",$agent))||(ereg("^Nokia6610.*",$agent))||(ereg("^Nokia7210.*",$agent))||(ereg("^Nokia7250.*",$agent))||(ereg("^Nokia7650.*",$agent))||(ereg("^Nokia5100.*",$agent))||(ereg("^Nokia3650.*",$agent))||(ereg("^Nokia6800.*",$agent))||(ereg("^NokiaN-Gage.*",$agent))||(ereg("^SonyEricssonT610.*",$agent))||(ereg("^Nokia6600.*",$agent))||(ereg("^SonyEricssonZ600.*",$agent))||(ereg("^SonyEricssonT630.*",$agent))) return 1; else return 0;
}

function smileys($text)
{
#	return $text;
	$agent=$_SERVER['HTTP_USER_AGENT'];
	if (color_phone($agent)) {
		$text=ereg_replace(":eta:", "<img src=\"/img/color/eta_vot.gif\" alt=\"eta\"/>", $text);
                $text=ereg_replace(":K", "<img src=\"/img/color/sm101.gif\" alt=\":K\"/>", $text);
                $text=ereg_replace(":!", "<img src=\"/img/color/sm166.gif\" alt=\":!\"/>", $text);
                $text=ereg_replace(":pist:", "<img src=\"/img/color/sm133.gif\" alt=\"pist\"/>", $text);
                $text=ereg_replace(":lol:", "<img src=\"/img/color/sm156.gif\" alt=\"lol\"/>", $text); 
                $text=ereg_replace(":vis:", "<img src=\"/img/color/sm115.gif\" alt=\"vis\"/>", $text); 
                $text=ereg_replace(":clozet:", "<img src=\"/img/color/sm195.gif\" alt=\"clozet\"/>", $text); 
                $text=ereg_replace(":pivo:", "<img src=\"/img/color/sm198.gif\" alt=\"pivo\"/>", $text); 
                $text=ereg_replace(":birul:", "<img src=\"/img/color/birul.gif\" alt=\"birul\"/>", $text);
                $text=ereg_replace(":chupa:", "<img src=\"/img/color/chupa.gif\" alt=\"chupa\"/>", $text);
		$text=ereg_replace(":zheka:", "<img src=\"/img/color/zheka.gif\" alt=\"genij\"/>", $text);
                $text=ereg_replace(":solvita:", "<img src=\"/img/color/solvita.gif\" alt=\"solvita\"/>", $text);
                $text=ereg_replace(":Nik:", "<img src=\"/img/color/nik.gif\" alt=\"Nik\"/>", $text);
                $text=ereg_replace(":her:", "<img src=\"/img/color/her.gif\" alt=\"Herrurg\"/>", $text);
                $text=ereg_replace(":mik:", "<img src=\"/img/color/mik.gif\" alt=\"MiK\"/>", $text);
                $text=ereg_replace(":den:", "<img src=\"/img/color/den.gif\" alt=\"SPY\"/>", $text);
                $text=ereg_replace(":oslik:", "<img src=\"/img/color/oslik.gif\" alt=\"Oslik\"/>", $text);
                $text=ereg_replace(":andy:", "<img src=\"/img/color/Andy.gif\" alt=\"Andy\"/>", $text);
                $text=ereg_replace(":kot:", "<img src=\"/img/color/Kot.gif\" alt=\"Kot\"/>", $text);                
                $text=ereg_replace(":moroz:", "<img src=\"/img/color/moroz.gif\" alt=\"otmorozki\"/>", $text);
                $text=ereg_replace(":rasta:", "<img src=\"/img/color/rasta.gif\" alt=\"rasta\"/>", $text);
                $text=ereg_replace(":hohol:", "<img src=\"/img/color/hohol.gif\" alt=\"hohol\"/>", $text);
                $text=ereg_replace(":X", "<img src=\"/img/color/ill.gif\" alt=\":X\"/>", $text);
		$text=ereg_replace(":\?", "<img src=\"/img/color/confused.gif\" alt=\":?\"/>", $text);
		$text=ereg_replace(":D", "<img src=\"/img/color/biggrin.gif\" alt=\":D\"/>", $text);
                $text=ereg_replace(":J", "<img src=\"/img/color/wow.gif\" alt=\":J\"/>", $text);
                $text=ereg_replace(":T", "<img src=\"/img/color/party.gif\" alt=\":T\"/>", $text);
		$text=ereg_replace(":)", "<img src=\"/img/color/smile.gif\" alt=\":)\"/>", $text);
		$text=ereg_replace(":P", "<img src=\"/img/color/tongue.gif\" alt=\":P\"/>", $text);
		$text=ereg_replace(":]", "<img src=\"/img/color/wink.gif\" alt=\":]\"/>", $text);
		$text=ereg_replace(";)", "<img src=\"/img/color/wink.gif\" alt=\":]\"/>", $text);
		$text=ereg_replace(":/", "<img src=\"/img/color/wht.gif\" alt=\":/\"/>", $text);
		$text=ereg_replace("8)", "<img src=\"/img/color/cool.gif\" alt=\"8)\"/>", $text);
		$text=ereg_replace(":L", "<img src=\"/img/color/cry2.gif\" alt=\":L\"/>", $text);
		$text=ereg_replace(":\(","<img src=\"/img/color/frown.gif\" alt=\":(\"/>", $text);
		$text=ereg_replace(":O", "<img src=\"/img/color/O.gif\" alt=\":O\"/>", $text);
		$text=ereg_replace(":#", "<img src=\"/img/color/mad.gif\" alt=\":#\"/>", $text);
		$text=ereg_replace(":R", "<img src=\"/img/color/shy.gif\" alt=\":R\"/>", $text);
		$text=ereg_replace(":\*","<img src=\"/img/color/10.gif\" alt=\":*\"/>", $text);
                $text=ereg_replace(":A","<img src=\"/img/color/ma.gif\" alt=\":A\"/>", $text);
		$text=ereg_replace(":I", "<img src=\"/img/color/wan.gif\" alt=\":I\"/>", $text);
        $text=ereg_replace(":Z", "<img src=\"/img/color/tecsha.gif\" alt=\":Z\"/>", $text);
    	$text=ereg_replace(":online:","<img src=\"/img/color/online.gif\" alt=\"secret\"/>", $text);
    	$text=ereg_replace(":g:","<img src=\"/img/color/g.gif\" alt=\"g\"/>", $text);
		$text=ereg_replace(":er:", "<img src=\"/img/color/er.gif\" alt=\":er:\"/>", $text);
                $text=ereg_replace(":Q", "<img src=\"/img/color/str.gif\" alt=\":Q\"/>", $text);
                $text=ereg_replace(":W", "<img src=\"/img/color/wantuz.gif\" alt=\":W\"/>", $text);
                $text=ereg_replace(":eda:", "<img src=\"/img/color/eda.gif\" alt=\":eda:\"/>", $text);
		$text=ereg_replace(":beer:","<img src=\"/img/color/14.gif\" alt=\"beer\"/>", $text);
		$text=ereg_replace(":kiss:","<img src=\"/img/color/kiss1.gif\" alt=\"kiss\"/>", $text);
		$text=ereg_replace(":flower:","<img src=\"/img/color/flower.gif\" alt=\"flower\"/>", $text);
		$text=ereg_replace(":drink:","<img src=\"/img/color/drink.gif\" alt=\"drink\"/>", $text);
		$text=ereg_replace(":clouds:","<img src=\"/img/color/clouds.gif\" alt=\"clouds\"/>", $text);
		$text=ereg_replace(":E","<img src=\"/img/color/angry.gif\" alt=\":E\"/>", $text);
		$text=ereg_replace(":coeur:","<img src=\"/img/color/coeur.gif\" alt=\"coeur\"/>", $text);
		$text=ereg_replace(":coffee:","<img src=\"/img/color/coffee.gif\" alt=\"coffee\"/>", $text);
		$text=ereg_replace(":sun:","<img src=\"/img/color/sun.gif\" alt=\"sun\"/>", $text);
		$text=ereg_replace(":hand:","<img src=\"/img/color/hand.gif\" alt=\"hand\"/>", $text);
		$text=ereg_replace(":love:","<img src=\"/img/color/love.gif\" alt=\"love\"/>", $text);
		$text=ereg_replace(":sunny:","<img src=\"/img/color/sunny.gif\" alt=\"sunny\"/>", $text);
		$text=ereg_replace(":rose:","<img src=\"/img/color/rose.gif\" alt=\"rose\"/>", $text);
		$text=ereg_replace(":present:","<img src=\"/img/color/present.gif\" alt=\"present\"/>", $text);
    	$text=ereg_replace(":h:","<img src=\"/img/color/h.gif\" alt=\"h\"/>", $text);
		$text=ereg_replace(":toilet:","<img src=\"/img/color/toilet.gif\" alt=\"toilet\"/>", $text);
		$text=ereg_replace(":rain:","<img src=\"/img/color/rain.gif\" alt=\"rain\"/>", $text);
		$text=ereg_replace(":rainy:","<img src=\"/img/color/rainy.gif\" alt=\"rainy\"/>", $text);
		$text=ereg_replace(":star:","<img src=\"/img/color/star.gif\" alt=\"star\"/>", $text);
		$text=ereg_replace(":phone:","<img src=\"/img/color/phone.gif\" alt=\"phone\"/>", $text);
		$text=ereg_replace(":mail:","<img src=\"/img/color/mail.gif\" alt=\"mail\"/>", $text);
		$text=ereg_replace(":money:","<img src=\"/img/color/money.gif\" alt=\"money\"/>", $text);
		$text=ereg_replace(":money2:","<img src=\"/img/color/money2.gif\" alt=\"money\"/>", $text);
		$text=ereg_replace(":monster:","<img src=\"/img/color/monster.gif\" alt=\"monster\"/>", $text);
		$text=ereg_replace(":tv:","<img src=\"/img/color/tv.gif\" alt=\"tv\"/>", $text);
    	$text=ereg_replace(":snow:","<img src=\"/img/color/snow.gif\" alt=\"snow\"/>", $text);
    	$text=ereg_replace(":sluni:","<img src=\"/img/color/sluni.gif\" alt=\"sluni\"/>", $text);
    	$text=ereg_replace(":auto:","<img src=\"/img/color/auto.gif\" alt=\"auto\"/>", $text);
    	$text=ereg_replace(":vantuz:","<img src=\"/img/color/vantuz.gif\" alt=\"vantuz\"/>", $text);
    	$text=ereg_replace(":bibi:","<img src=\"/img/color/bibi.gif\" alt=\"bibi\"/>", $text);
    	$text=ereg_replace(":toy:","<img src=\"/img/color/toy.gif\" alt=\"toy\"/>", $text);
    	$text=ereg_replace(":toy2:","<img src=\"/img/color/toy2.gif\" alt=\"toy2\"/>", $text);
    	$text=ereg_replace(":gun:","<img src=\"/img/color/gun.gif\" alt=\"gun\"/>", $text);
		$text=ereg_replace(":elka:", "<img src=\"/img/color/elka.gif\" alt=\":elka:\"/>", $text);
		$text=ereg_replace(":kisa:", "<img src=\"/img/color/kisa.gif\" alt=\":kisa:\"/>", $text);
		$text=ereg_replace(":ded:", "<img src=\"/img/color/ded.gif\" alt=\":ded:\"/>", $text);
		$text=ereg_replace(":ufo:","<img src=\"/img/color/ufo2.gif\" alt=\"ufo\"/>", $text);
    	$text=ereg_replace(":candy:","<img src=\"/img/color/candy.gif\" alt=\"candy\"/>", $text);
	} else {
		$text=ereg_replace(":eta:", "<img src=\"/img/eta_vot.wbmp\" alt=\"eta\"/>", $text);
                $text=ereg_replace(":solvita:", "<img src=\"/img/solvita.wbmp\" alt=\"solvita\"/>", $text);
                $text=ereg_replace(":Nik:", "<img src=\"/img/nik.wbmp\" alt=\"Nik\"/>", $text);  
                $text=ereg_replace(":her:", "<img src=\"/img/her.wbmp\" alt=\"Herrurg\"/>", $text);
                $text=ereg_replace(":mik:", "<img src=\"/img/mik.wbmp\" alt=\"MiK\"/>", $text);
                $text=ereg_replace(":den:", "<img src=\"/img/den.wbmp\" alt=\"SPY\"/>", $text);
                $text=ereg_replace(":oslik:", "<img src=\"/img/oslik.wbmp\" alt=\"Oslik\"/>", $text);
                $text=ereg_replace(":zheka:", "<img src=\"/img/zheka.wbmp\" alt=\"genij\"/>", $text);
                $text=ereg_replace(":andy:", "<img src=\"/img/Andy.wbmp\" alt=\"Andy\"/>", $text);
                $text=ereg_replace(":kot:", "<img src=\"/img/Kot.wbmp\" alt=\"Kot\"/>", $text);
                $text=ereg_replace(":moroz:", "<img src=\"/img/moroz.wbmp\" alt=\"otmorozki\"/>", $text);
                $text=ereg_replace(":rasta:", "<img src=\"/img/rasta.wbmp\" alt=\"rasta\"/>", $text);
                $text=ereg_replace(":clozet:", "<img src=\"/img/sm195.wbmp\" alt=\"clozet\"/>", $text);
                $text=ereg_replace(":pivo:", "<img src=\"/img/sm198.wbmp\" alt=\"pivo\"/>", $text);
                $text=ereg_replace(":vis:", "<img src=\"/img/sm115.wbmp\" alt=\"vis\"/>", $text);
                $text=ereg_replace(":lol:", "<img src=\"/img/sm156.wbmp\" alt=\"lol\"/>", $text);
                $text=ereg_replace(":pist:", "<img src=\"/img/sm133.wbmp\" alt=\"pist\"/>", $text);
                $text=ereg_replace(":K", "<img src=\"/img/sm101.wbmp\" alt=\":K\"/>", $text);
                $text=ereg_replace(":!", "<img src=\"/img/sm166.wbmp\" alt=\":!\"/>", $text);
                $text=ereg_replace(":birul:", "<img src=\"/img/birul.wbmp\" alt=\"birul\"/>", $text);
                $text=ereg_replace(":chupa:", "<img src=\"/img/chupa.wbmp\" alt=\"chupa\"/>", $text);	
                $text=ereg_replace(":D", "<img src=\"/img/0.wbmp\" alt=\":D\"/>", $text);
                $text=ereg_replace(":W", "<img src=\"/img/wantuz.wbmp\" alt=\":W\"/>", $text);
                $text=ereg_replace(":J", "<img src=\"/img/wow.wbmp\" alt=\":J\"/>", $text);
                $text=ereg_replace(":Q", "<img src=\"/img/str.wbmp\" alt=\":Q\"/>", $text);
                $text=ereg_replace(":A", "<img src=\"/img/ma.wbmp\" alt=\":A\"/>", $text);
                $text=ereg_replace(":T", "<img src=\"/img/party.wbmp\" alt=\":T\"/>", $text);
                $text=ereg_replace(":X", "<img src=\"/img/ill.wbmp\" alt=\":X\"/>", $text);
                $text=ereg_replace(":Z", "<img src=\"/img/tescha.wbmp\" alt=\":Z\"/>", $text);
		$text=ereg_replace(":)", "<img src=\"/img/1.wbmp\" alt=\":)\"/>", $text);
		$text=ereg_replace(":P", "<img src=\"/img/4.wbmp\" alt=\":P\"/>", $text);
		$text=ereg_replace(":]", "<img src=\"/img/3.wbmp\" alt=\":]\"/>", $text);
		$text=ereg_replace(";)", "<img src=\"/img/3.wbmp\" alt=\":]\"/>", $text);
		$text=ereg_replace(":/", "<img src=\"/img/11.wbmp\" alt=\":/\"/>", $text);
		$text=ereg_replace("8)", "<img src=\"/img/8.wbmp\" alt=\"8)\"/>", $text);
		$text=ereg_replace(":L", "<img src=\"/img/12.wbmp\" alt=\":L\"/>", $text);
		$text=ereg_replace(":\(","<img src=\"/img/2.wbmp\" alt=\":(\"/>", $text);
		$text=ereg_replace(":#", "<img src=\"/img/9.wbmp\" alt=\":#\"/>", $text);
		$text=ereg_replace(":O", "<img src=\"/img/O.wbmp\" alt=\":O\"/>", $text);
		$text=ereg_replace(":R", "<img src=\"/img/02.wbmp\" alt=\":R\"/>", $text);
		$text=ereg_replace(":\*","<img src=\"/img/10.wbmp\" alt=\":*\"/>", $text);
		$text=ereg_replace(":I", "<img src=\"/img/01.wbmp\" alt=\":I\"/>", $text);
    	        $text=ereg_replace(":online:","<img src=\"/img/online.wbmp\" alt=\"secret\"/>", $text);
		$text=ereg_replace(":er:", "<img src=\"/img/er.wbmp\" alt=\":er:\"/>", $text);
    	        $text=ereg_replace(":g:","<img src=\"/img/g.wbmp\" alt=\"g\"/>", $text);
		$text=ereg_replace(":beer:","<img src=\"/img/14.wbmp\" alt=\"beer\"/>", $text);
                $text=ereg_replace(":eda:","<img src=\"/img/eda.wbmp\" alt=\"eda\"/>", $text);
		$text=ereg_replace(":kiss:","<img src=\"/img/kiss.wbmp\" alt=\"kiss\"/>", $text);
		$text=ereg_replace(":flower:","<img src=\"/img/flower.wbmp\" alt=\"flower\"/>", $text);
		$text=ereg_replace(":drink:","<img src=\"/img/drink.wbmp\" alt=\"drink\"/>", $text);
		$text=ereg_replace(":clouds:","<img src=\"/img/clouds.wbmp\" alt=\"clouds\"/>", $text);
		$text=ereg_replace(":E","<img src=\"/img/angry.wbmp\" alt=\":E\"/>", $text);
		$text=ereg_replace(":coeur:","<img src=\"/img/coeur.wbmp\" alt=\"coeur\"/>", $text);
		$text=ereg_replace(":coffee:","<img src=\"/img/coffee.wbmp\" alt=\"coffee\"/>", $text);
		$text=ereg_replace(":hand:","<img src=\"/img/hand.wbmp\" alt=\"hand\"/>", $text);
		$text=ereg_replace(":love:","<img src=\"/img/love.wbmp\" alt=\"love\"/>", $text);
		$text=ereg_replace(":sun:","<img src=\"/img/sun.wbmp\" alt=\"sun\"/>", $text);
		$text=ereg_replace(":sunny:","<img src=\"/img/sunny.wbmp\" alt=\"sunny\"/>", $text);
		$text=ereg_replace(":rose:","<img src=\"/img/rose.wbmp\" alt=\"rose\"/>", $text);
		$text=ereg_replace(":present:","<img src=\"/img/present.wbmp\" alt=\"present\"/>", $text);
         	$text=ereg_replace(":h:","<img src=\"/img/h.wbmp\" alt=\"h\"/>", $text);
		$text=ereg_replace(":toilet:","<img src=\"/img/toilet.wbmp\" alt=\"toilet\"/>", $text);
		$text=ereg_replace(":rain:","<img src=\"/img/rain.wbmp\" alt=\"rain\"/>", $text);
		$text=ereg_replace(":rainy:","<img src=\"/img/rainy.wbmp\" alt=\"rainy\"/>", $text);
		$text=ereg_replace(":star:","<img src=\"/img/star.wbmp\" alt=\"star\"/>", $text);
		$text=ereg_replace(":phone:","<img src=\"/img/phone.wbmp\" alt=\"phone\"/>", $text);
		$text=ereg_replace(":mail:","<img src=\"/img/mail.wbmp\" alt=\"mail\"/>", $text);
		$text=ereg_replace(":money:","<img src=\"/img/money.wbmp\" alt=\"money\"/>", $text);
		$text=ereg_replace(":money2:", "<img src=\"/img/money2.wbmp\" alt=\":money2:\"/>", $text);
		$text=ereg_replace(":monster:","<img src=\"/img/monster.wbmp\" alt=\"monster\"/>", $text);
		$text=ereg_replace(":tv:","<img src=\"/img/tv.wbmp\" alt=\"tv\"/>", $text);
    	$text=ereg_replace(":snow:","<img src=\"/img/snow.wbmp\" alt=\"snow\"/>", $text);
    	$text=ereg_replace(":sluni:","<img src=\"/img/sluni.wbmp\" alt=\"sluni\"/>", $text);
    	$text=ereg_replace(":auto:","<img src=\"/img/auto.wbmp\" alt=\"auto\"/>", $text);
    	$text=ereg_replace(":vantuz:","<img src=\"/img/vantuz.wbmp\" alt=\"vantuz\"/>", $text);
    	$text=ereg_replace(":bibi:","<img src=\"/img/bibi.wbmp\" alt=\"bibi\"/>", $text);
    	$text=ereg_replace(":toy:","<img src=\"/img/toy.wbmp\" alt=\"toy\"/>", $text);
    	$text=ereg_replace(":toy2:","<img src=\"/img/toy2.wbmp\" alt=\"toy2\"/>", $text);
    	$text=ereg_replace(":gun:","<img src=\"/img/gun.wbmp\" alt=\"gun\"/>", $text);
		$text=ereg_replace(":elka:", "<img src=\"/img/elka.wbmp\" alt=\":elka:\"/>", $text);
		$text=ereg_replace(":kisa:", "<img src=\"/img/kisa.wbmp\" alt=\":kisa:\"/>", $text);
		$text=ereg_replace(":ded:", "<img src=\"/img/ded.wbmp\" alt=\":ded:\"/>", $text);
		$text=ereg_replace(":ufo:","<img src=\"/img/ufo2.wbmp\" alt=\"ufo\"/>", $text);
    	$text=ereg_replace(":candy:","<img src=\"/img/candy.wbmp\" alt=\"candy\"/>", $text);
	}

        $text=ereg_replace(":\[","<img src=\"/img/7.wbmp\" alt=\":[\"/>", $text);
	$text=ereg_replace(":eye:","<img src=\"/img/eye.wbmp\" alt=\"eye\"/>", $text);
	$text=ereg_replace(":bed:","<img src=\"/img/bed.wbmp\" alt=\"bed\"/>", $text);
	$text=ereg_replace(":sex:","<img src=\"/img/sex.wbmp\" alt=\"sex\"/>", $text);
	$text=ereg_replace(":moon:","<img src=\"/img/moon.wbmp\" alt=\"moon\"/>", $text);
	$text=ereg_replace(":music:","<img src=\"/img/music.wbmp\" alt=\"music\"/>", $text);
	$text=ereg_replace(":boy:","<img src=\"/img/boy.wbmp\" alt=\"boy\"/>", $text);
	$text=ereg_replace(":girl:","<img src=\"/img/girl.wbmp\" alt=\"girl\"/>", $text);
	$text=ereg_replace(":hate:","<img src=\"/img/hate.wbmp\" alt=\"hate\"/>", $text);
	$text=ereg_replace(":dog:","<img src=\"/img/dog.wbmp\" alt=\"dog\"/>", $text);
	$text=ereg_replace(":house:","<img src=\"/img/house.wbmp\" alt=\"house\"/>", $text);
	$text=ereg_replace(":kitten:","<img src=\"/img/kitten.wbmp\" alt=\"kitten\"/>", $text);
    $text=ereg_replace(":milk:","<img src=\"/img/milk.wbmp\" alt=\"milk\"/>", $text);
    $text=ereg_replace(":cat:","<img src=\"/img/cat.wbmp\" alt=\"cat\"/>", $text);
    $text=ereg_replace(":gugu:","<img src=\"/img/gugu.wbmp\" alt=\"gugu\"/>", $text);
$text=ereg_replace(":baba:", "<img src=\"/img/baba.wbmp\" alt=\":baba:\"/>", $text);
$text=ereg_replace(":bomba:", "<img src=\"/img/bomba.wbmp\" alt=\":bomba:\"/>", $text);
$text=ereg_replace(":kolokol:", "<img src=\"/img/kolokol.wbmp\" alt=\":kolokol:\"/>", $text);
$text=ereg_replace(":music2:", "<img src=\"/img/music2.wbmp\" alt=\":music2:\"/>", $text);
$text=ereg_replace(":nosok:", "<img src=\"/img/nosok.wbmp\" alt=\":nosok:\"/>", $text);
   
	return $text;
}

function tr_conv($text)
{
#	$text=ereg_replace("a", "єђ", $text);
#	$text=ereg_replace("b", "є‘", $text);
#	$text=ereg_replace("v", "є’", $text);
#	$text=ereg_replace("g", "єЃ", $text);
#	$text=ereg_replace("d", "є‡", $text);
#	$text=ereg_replace("e", "єІ", $text);
#	$text=ereg_replace("\*", "єґ", $text);
#	$text=ereg_replace("z", "є§", $text);
#	$text=ereg_replace("i", "є¦", $text);
#	$text=ereg_replace("q", "єµ", $text);
#	$text=ereg_replace("k", "єЎ", $text);
#	$text=ereg_replace("l", "єЁ", $text);
#	$text=ereg_replace("m", "є®", $text);
#	$text=ereg_replace("n", "є­", $text);
#	$text=ereg_replace("o", "є¬", $text);
#	$text=ereg_replace("p", "єѓ", $text);
#	$text=ereg_replace("r", "¶б", $text);
#	$text=ereg_replace("s", "¶в", $text);
#	$text=ereg_replace("t", "¶ч", $text);
#	$text=ereg_replace("y", "¶з", $text);
#	$text=ereg_replace("f", "¶д", $text);
#	$text=ereg_replace("h", "¶е", $text);
#	$text=ereg_replace("c", "¶ц", $text);
#	$text=ereg_replace("4", "¶ъ", $text);
#	$text=ereg_replace("6", "¶й", $text);
#	$text=ereg_replace("w", "¶к", $text);
#	$text=ereg_replace("`", "¶л", $text);
#	$text=ereg_replace("x", "¶м", $text);
#	$text=ereg_replace("'", "¶н", $text);
#	$text=ereg_replace("\]", "¶о", $text);
#	$text=ereg_replace("u", "¶п", $text);
#	$text=ereg_replace("j", "¶р", $text);

#	$text=ereg_replace("A", "єт", $text);
#	$text=ereg_replace("B", "єу", $text);
#	$text=ereg_replace("V", "єф", $text);
#	$text=ereg_replace("G", "єх", $text);
#	$text=ereg_replace("D", "єж", $text);
#	$text=ereg_replace("E", "єи", $text);
#	$text=ereg_replace("#", "єг", $text);
#	$text=ereg_replace("Z", "єю", $text);
#	$text=ereg_replace("I", "єы", $text);
#	$text=ereg_replace("Q", "єэ", $text);
#	$text=ereg_replace("L", "єщ", $text);
#	$text=ereg_replace("N", "єь", $text);
#	$text=ereg_replace("P", "єс", $text);
#	$text=ereg_replace("R", "єБ", $text);
#	$text=ereg_replace("S", "єВ", $text);
#	$text=ereg_replace("Y", "єЗ", $text);
#	$text=ereg_replace("F", "єД", $text);
#	$text=ereg_replace("H", "єЕ", $text);
#	$text=ereg_replace("C", "єЦ", $text);
#	$text=ereg_replace("\|", "єЪ", $text);
#	$text=ereg_replace("_", "єЙ", $text);
#	$text=ereg_replace("W", "єК", $text);
#	$text=ereg_replace("X", "єМ", $text);
#	$text=ereg_replace("3", "єО", $text);
#	$text=ereg_replace("U", "єП", $text);
#	$text=ereg_replace("J", "єР", $text);

	$a = explode(":", iconv("KOI8-R", "UTF-8", ":б:в:ч:з:д:е:і:ц:ъ:й:к:л:м:н:о:п:р:т:у:ф:х:ж:и:г:ю:ы:э:я:щ:ш:ь:а:с:Б:В:Ч:З:Д:Е:Ј:Ц:Ъ:Й:К:Л:М:Н:О:П:Р:Т:У:Ф:Х:Ж:И:Г:Ю:Ы:Э:Я:Щ:Ш:Ь:А:С:"));

	$text=ereg_replace("Ya",  $a[33], $text);
	$text=ereg_replace("B",   $a[2], $text);
	$text=ereg_replace("V",   $a[3], $text);
	$text=ereg_replace("G",   $a[4], $text);
	$text=ereg_replace("D",   $a[5], $text);
	$text=ereg_replace("ZH",  $a[8], $text);
	$text=ereg_replace("Zh",  $a[8], $text);
	$text=ereg_replace("Z",   $a[9], $text);
	$text=ereg_replace("I",   $a[10], $text);
	$text=ereg_replace("J",   $a[11], $text);
	$text=ereg_replace("L",   $a[13], $text);
	$text=ereg_replace("N",   $a[15], $text);
	$text=ereg_replace("P",   $a[17], $text);
	$text=ereg_replace("R",   $a[18], $text);
	$text=ereg_replace("F",   $a[22], $text);
	$text=ereg_replace("TS",  $a[24], $text);
	$text=ereg_replace("Ts",  $a[24], $text);
	$text=ereg_replace("SCH", $a[27], $text);
	$text=ereg_replace("Sch", $a[27], $text);
	$text=ereg_replace("CH",  $a[25], $text);
	$text=ereg_replace("Ch",  $a[25], $text);
	$text=ereg_replace("SH",  $a[26], $text);
	$text=ereg_replace("Sh",  $a[26], $text);
	$text=ereg_replace("W",   $a[29], $text);
	$text=ereg_replace("H",   $a[23], $text);
	$text=ereg_replace("S",   $a[19], $text);
	$text=ereg_replace("Q",   $a[31], $text);
	$text=ereg_replace("YU",  $a[32], $text);
	$text=ereg_replace("Yu",  $a[32], $text);
	$text=ereg_replace("Y",   $a[7], $text);
	$text=ereg_replace("U",   $a[21], $text);
	$text=ereg_replace("ya",  $a[66], $text);
	$text=ereg_replace("b",   $a[35], $text);
	$text=ereg_replace("v",   $a[36], $text);
	$text=ereg_replace("g",   $a[37], $text);
	$text=ereg_replace("d",   $a[38], $text);
	$text=ereg_replace("zh",  $a[41], $text);
	$text=ereg_replace("z",   $a[42], $text);
	$text=ereg_replace("i",   $a[43], $text);
	$text=ereg_replace("j",   $a[44], $text);
	$text=ereg_replace("k",   $a[45], $text);
	$text=ereg_replace("l",   $a[46], $text);
	$text=ereg_replace("m",   $a[47], $text);
	$text=ereg_replace("n",   $a[48], $text);
	$text=ereg_replace("p",   $a[50], $text);
	$text=ereg_replace("r",   $a[51], $text);
	$text=ereg_replace("f",   $a[55], $text);
	$text=ereg_replace("ts",  $a[57], $text);
	$text=ereg_replace("t",   $a[53], $text);
	$text=ereg_replace("sch", $a[60], $text);
	$text=ereg_replace("ch",  $a[58], $text);
	$text=ereg_replace("sh",  $a[59], $text);
	$text=ereg_replace("w",   $a[62], $text);
	$text=ereg_replace("h",   $a[56], $text);
	$text=ereg_replace("s",   $a[52], $text);
	$text=ereg_replace("\"",  $a[63], $text);
	$text=ereg_replace("'",   $a[61], $text);
	$text=ereg_replace("q",   $a[64], $text);
	$text=ereg_replace("yu",  $a[65], $text);
	$text=ereg_replace("y",   $a[54], $text);
#	$text=ereg_replace("x",   $a[], $text);
	$text=ereg_replace("u",   $a[54], $text);

	return $text;
}

function psmileys($text)
{
	$agent=$_SERVER['HTTP_USER_AGENT'];
	if (color_phone($agent)) {
		$text=ereg_replace(":ass:", "<img src=\"/img/color/ass.gif\" alt=\"ass\"/>", $text);
		$text=ereg_replace(":ban:", "<img src=\"/img/color/ban.gif\" alt=\"ban\"/>", $text);
	} else {
		$text=ereg_replace(":ass:", "<img src=\"/img/ass.wbmp\" alt=\"ass\"/>", $text);
		$text=ereg_replace(":ban:", "<img src=\"/img/ban.wbmp\" alt=\"ban\"/>", $text);
	}
	$text=ereg_replace(":SPY:", "<img src=\"/img/fuck.wbmp\" alt=\"fuck\"/>", $text);
	$text=ereg_replace(":cock:", "<img src=\"/img/cock.wbmp\" alt=\"cock\"/>", $text);
	$text=ereg_replace(":shit:", "<img src=\"/img/shit.wbmp\" alt=\"shit\"/>", $text);
	$text=ereg_replace(":s1:", "<img src=\"/img/adult/2298.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":s2:", "<img src=\"/img/adult/2299.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":s3:", "<img src=\"/img/adult/2300.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":nik:", "<img src=\"/img/adult/2302.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":s5:", "<img src=\"/img/adult/2308.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":s6:", "<img src=\"/img/adult/2331.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":West:", "<img src=\"/img/adult/West.wbmp\" alt=\"secret\"/>", $text);
	return $text;
}


function o_smileys($text)
{
	$text=ereg_replace(":cock:", "<img src=\"/img/cens.wbmp\" alt=\"cock\"/>", $text);
	$text=ereg_replace(":s1:", "<img src=\"/img/cens.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":s2:", "<img src=\"/img/cens.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":s3:", "<img src=\"/img/cens.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":nik:", "<img src=\"/img/cens.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":s5:", "<img src=\"/img/cens.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":s6:", "<img src=\"/img/cens.wbmp\" alt=\"secret\"/>", $text);
	return $text;
}


function msmileys($text)
{
    $text=ereg_replace(":ameli:","<img src=\"/img/ameli.wbmp\" alt=\"ameli\"/>", $text);
    $text=ereg_replace(":katrin:","<img src=\"/img/katrin.wbmp\" alt=\"katrin\"/>", $text);
#    $text=ereg_replace(":bea:","<img src=\"/img/bea.wbmp\" alt=\"bea\"/>", $text);
    $text=ereg_replace(":w:","<img src=\"/img/w.wbmp\" alt=\"w\"/>", $text);
    $text=ereg_replace(":vch:","<img src=\"/img/vch.wbmp\" alt=\"vch\"/>", $text);
#    $text=ereg_replace(":flame:","<img src=\"/img/flame.wbmp\" alt=\"flame\"/>", $text);
#$text=ereg_replace(":alisa:","<img src=\"/img/alisa.wbmp\" alt=\"alisa\"/>", $text);
$text=ereg_replace(":Nik:","<img src=\"/img/nik.wbmp\" alt=\"nik\"/>", $text);
$text=ereg_replace(":secret:","<img src=\"/img/loh.wbmp\" alt=\"secret\"/>", $text);
#$text=ereg_replace(":anya:","<img src=\"/img/anya.wbmp\" alt=\"anya\"/>", $text);
#$text=ereg_replace(":galli:","<img src=\"/img/galli.wbmp\" alt=\"galli\"/>", $text);
#$text=ereg_replace(":galka:","<img src=\"/img/galka.wbmp\" alt=\"galka\"/>", $text);
#  $text=ereg_replace(":koshka:","<img src=\"/img/koshka.wbmp\" alt=\"koshka\"/>", $text);
  $text=ereg_replace(":west:","<img src=\"/img/west.wbmp\" alt=\"west\"/>", $text);
#$text=ereg_replace(":kotya:","<img src=\"/img/kotya.wbmp\" alt=\"kotya\"/>", $text);
$text=ereg_replace(":mik:","<img src=\"/img/mik.wbmp\" alt=\"mik\"/>", $text);
#$text=ereg_replace(":zaya:","<img src=\"/img/zaya.wbmp\" alt=\"zaya\"/>", $text);
$text=ereg_replace(":king:","<img src=\"/img/king.wbmp\" alt=\"king\"/>", $text);
$text=ereg_replace(":olshin:","<img src=\"/img/olshin.wbmp\" alt=\"olshin\"/>", $text);

	return $text;
}

function ksmileys($text)
{
	$text=ereg_replace(":katrinka:","<img src=\"/img/avatars/kiss-nastenka.wbmp\" alt=\"super\"/>", $text);
	$text=ereg_replace(":kat:","<img src=\"/img/avatars/inkognita.wbmp\" alt=\"super\"/>", $text);
	$text=ereg_replace(":tig:","<img src=\"/img/avatars/tigrenok2.wbmp\" alt=\"secret\"/>", $text);
	$text=ereg_replace(":lote:","<img src=\"/img/avatars/lote.wbmp\" alt=\"secret\"/>", $text);
	return $text;
}

function counters()
{
?>
<p align="center">
<a href="http://pslink.ru/i.php?id=614">
<img src="http://pslink.ru/b.php?id=614" alt="PSLink rating" />
</a>
</p>
<?php
}
?>