<?php
@include "xconf.php";
/*
*функции генерации данных
*/
function switchtext($text){ //функция, выбирающая символ (из 36) по номеру ($text)
switch ($text){
case 1:
$a="q";
break;
case 2:
$a="w";
break;
case 3:
$a="e";
break;
case 4:
$a="r";
break;
case 5:
$a="t";
break;
case 6:
$a="y";
break;
case 7:
$a="u";
break;
case 8:
$a="i";
break;
case 9:
$a="o";
break;
case 10:
$a="p";
break;
case 11:
$a="a";
break;
case 12:
$a="s";
break;
case 13:
$a="d";
break;
case 14:
$a="f";
break;
case 15:
$a="g";
break;
case 16:
$a="h";
break;
case 17:
$a="j";
break;
case 18:
$a="k";
break;
case 19:
$a="l";
break;
case 20:
$a="z";
break;
case 21:
$a="x";
break;
case 22:
$a="c";
break;
case 23:
$a="v";
break;
case 24:
$a="b";
break;
case 25:
$a="n";
break;
case 26:
$a="m";
break;
case 27:
$a=1;
break;
case 28:
$a=2;
break;
case 29:
$a=3;
break;
case 30:
$a=4;
break;
case 31:
$a=5;
break;
case 32:
$a=6;
break;
case 33:
$a=7;
break;
case 34:
$a=8;
break;
case 35:
$a=9;
break;
case 36:
$a=0;
break;
}//end switch
return $a;
}
function randtext(){//создаёт рандомный пароль длиной в $kol символов
mt_srand();
$kol=mt_rand(4,10);
$text="";
for ($i=1;$i<=$kol;$i++){
$t=mt_rand(1,36);
$text.=switchtext($t);
}
return $text;
}
/*
*функции перекодировки
*/
function unicode ($s) { if ( (ord($s)>=192) & (ord($s)<=255) ) $hexvalue=dechex(ord($s)+848); if ($s=="Ё") $hexvalue="401"; if ($s=="ё") $hexvalue="451"; return("�".$hexvalue.";");}
function utf_encode ($s) { return(preg_replace("/[А-яЁё]/e","unicode('\\0')",$s));} //функция декодирования в утф-8
function echou($s){
echo utf_encode($s);
}
function translit($st){
$st=str_replace("А","А",$st);
$st=str_replace("Б","Б",$st);
$st=str_replace("В","В",$st);
$st=str_replace("Г","Г",$st);
$st=str_replace("Д","Д",$st);
$st=str_replace("Е","Е",$st);
$st=str_replace("Ё","Ё",$st);
$st=str_replace("Ж","Ж",$st);
$st=str_replace("З","З",$st);
$st=str_replace("И","И",$st);
$st=str_replace("Й","Й",$st);
$st=str_replace("К","К",$st);
$st=str_replace("Л","Л",$st);
$st=str_replace("М","М",$st);
$st=str_replace("Н","Н",$st);
$st=str_replace("О","О",$st);
$st=str_replace("П","П",$st);
$st=str_replace("Р","Р",$st);
$st=str_replace("С","С",$st);
$st=str_replace("Т","Т",$st);
$st=str_replace("У","У",$st);
$st=str_replace("Ф","Ф",$st);
$st=str_replace("Х","Х",$st);
$st=str_replace("Ц","Ц",$st);
$st=str_replace("Ч","Ч",$st);
$st=str_replace("Ш","Ш",$st);
$st=str_replace("Щ","Щ",$st);
$st=str_replace("Ъ","Ъ",$st);
$st=str_replace("Ы","Ы",$st);
$st=str_replace("Ь","Ь",$st);
$st=str_replace("Э","Р ",$st);
$st=str_replace("Ю","Ю",$st);
$st=str_replace("Я","Я",$st);
$st=str_replace("а","а",$st);
$st=str_replace("б","б",$st);
$st=str_replace("в","в",$st);
$st=str_replace("г","г",$st);
$st=str_replace("д","д",$st);
$st=str_replace("е","е",$st);
$st=str_replace("ё","ё",$st);
$st=str_replace("ж","ж",$st);
$st=str_replace("з","з",$st);
$st=str_replace("и","и",$st);
$st=str_replace("й","й",$st);
$st=str_replace("к","к",$st);
$st=str_replace("л","л",$st);
$st=str_replace("м","м",$st);
$st=str_replace("н","н",$st);
$st=str_replace("о","о",$st);
$st=str_replace("п","п",$st);
$st=str_replace("р","р",$st);
$st=str_replace("с","с",$st);
$st=str_replace("т","т",$st);
$st=str_replace("у","у",$st);
$st=str_replace("ф","ф",$st);
$st=str_replace("х","х",$st);
$st=str_replace("ц","ц",$st);
$st=str_replace("ч","ч",$st);
$st=str_replace("ш","ш",$st);
$st=str_replace("щ","щ",$st);
$st=str_replace("ъ","ъ",$st);
$st=str_replace("ы","ы",$st);
$st=str_replace("ь","ь",$st);
$st=str_replace("э","э",$st);
$st=str_replace("ю","ю",$st);
$st=str_replace("я","я",$st);
$st=str_replace("А","А",$st);
$st=str_replace("Б","Б",$st);
$st=str_replace("В","В",$st);
$st=str_replace("Г","Г",$st);
$st=str_replace("Д","Д",$st);
$st=str_replace("Е","Е",$st);
$st=str_replace("Ё","Ё",$st);
$st=str_replace("Ж","Ж",$st);
$st=str_replace("З","З",$st);
$st=str_replace("И","И",$st);
$st=str_replace("Й","Й",$st);
$st=str_replace("К","К",$st);
$st=str_replace("Л","Л",$st);
$st=str_replace("М","М",$st);
$st=str_replace("Н","Н",$st);
$st=str_replace("О","О",$st);
$st=str_replace("П","П",$st);
$st=str_replace("Р","Р",$st);
$st=str_replace("С","С",$st);
$st=str_replace("Т","Т",$st);
$st=str_replace("У","У",$st);
$st=str_replace("Ф","Ф",$st);
$st=str_replace("Х","Х",$st);
$st=str_replace("Ц","Ц",$st);
$st=str_replace("Ч","Ч",$st);
$st=str_replace("Ш","Ш",$st);
$st=str_replace("Щ","Щ",$st);
$st=str_replace("Ъ","Ъ",$st);
$st=str_replace("Ы","Ы",$st);
$st=str_replace("Ь","Ь",$st);
$st=str_replace("Э","Р ",$st);
$st=str_replace("Ю","Ю",$st);
$st=str_replace("Я","Я",$st);
$st=str_replace("а","а",$st);
$st=str_replace("б","б",$st);
$st=str_replace("в","в",$st);
$st=str_replace("г","г",$st);
$st=str_replace("д","д",$st);
$st=str_replace("е","е",$st);
$st=str_replace("ё","ё",$st);
$st=str_replace("ж","ж",$st);
$st=str_replace("з","з",$st);
$st=str_replace("и","и",$st);
$st=str_replace("й","й",$st);
$st=str_replace("к","к",$st);
$st=str_replace("л","л",$st);
$st=str_replace("м","м",$st);
$st=str_replace("н","н",$st);
$st=str_replace("о","о",$st);
$st=str_replace("п","п",$st);
$st=str_replace("р","р",$st);
$st=str_replace("с","с",$st);
$st=str_replace("т","т",$st);
$st=str_replace("у","у",$st);
$st=str_replace("ф","ф",$st);
$st=str_replace("х","х",$st);
$st=str_replace("ц","ц",$st);
$st=str_replace("ч","ч",$st);
$st=str_replace("ш","ш",$st);
$st=str_replace("щ","щ",$st);
$st=str_replace("ъ","ъ",$st);
$st=str_replace("ы","ы",$st);
$st=str_replace("ь","ь",$st);
$st=str_replace("э","э",$st);
$st=str_replace("ю","ю",$st);
$st=str_replace("я","я",$st);
return $st;
}
function translit2($st){
$st=str_replace("А","А",$st);
$st=str_replace("Б","Б",$st);
$st=str_replace("В","В",$st);
$st=str_replace("Г","Г",$st);
$st=str_replace("Д","Д",$st);
$st=str_replace("Е","Е",$st);
$st=str_replace("Ё","Ё",$st);
$st=str_replace("Ж","Ж",$st);
$st=str_replace("З","З",$st);
$st=str_replace("И","И",$st);
$st=str_replace("Й","Й",$st);
$st=str_replace("К","К",$st);
$st=str_replace("Л","Л",$st);
$st=str_replace("М","М",$st);
$st=str_replace("Н","Н",$st);
$st=str_replace("О","О",$st);
$st=str_replace("П","П",$st);
$st=str_replace("Р","Р",$st);
$st=str_replace("С","С",$st);
$st=str_replace("Т","Т",$st);
$st=str_replace("У","У",$st);
$st=str_replace("Ф","Ф",$st);
$st=str_replace("Х","Х",$st);
$st=str_replace("Ц","Ц",$st);
$st=str_replace("Ч","Ч",$st);
$st=str_replace("Ш","Ш",$st);
$st=str_replace("Щ","Щ",$st);
$st=str_replace("Ъ","Ъ",$st);
$st=str_replace("Ы","Ы",$st);
$st=str_replace("Ь","Ь",$st);
$st=str_replace("Э","Р",$st);
$st=str_replace("Ю","Ю",$st);
$st=str_replace("Я","Я",$st);
$st=str_replace("а","а",$st);
$st=str_replace("б","б",$st);
$st=str_replace("в","в",$st);
$st=str_replace("г","г",$st);
$st=str_replace("д","д",$st);
$st=str_replace("е","е",$st);
$st=str_replace("ё","ё",$st);
$st=str_replace("ж","ж",$st);
$st=str_replace("з","з",$st);
$st=str_replace("и","и",$st);
$st=str_replace("й","й",$st);
$st=str_replace("к","к",$st);
$st=str_replace("л","л",$st);
$st=str_replace("м","м",$st);
$st=str_replace("н","н",$st);
$st=str_replace("о","о",$st);
$st=str_replace("п","п",$st);
$st=str_replace("р","р",$st);
$st=str_replace("с","с",$st);
$st=str_replace("т","т",$st);
$st=str_replace("у","у",$st);
$st=str_replace("ф","ф",$st);
$st=str_replace("х","х",$st);
$st=str_replace("ц","ц",$st);
$st=str_replace("ч","ч",$st);
$st=str_replace("ш","ш",$st);
$st=str_replace("щ","щ",$st);
$st=str_replace("ъ","ъ",$st);
$st=str_replace("ы","ы",$st);
$st=str_replace("ь","ь",$st);
$st=str_replace("э","э",$st);
$st=str_replace("ю","ю",$st);
$st=str_replace("я","я",$st);
return $st;
}
function mailtrans($st){
$st=str_replace("й","й",$st);
$st=str_replace("ц","ц",$st);
$st=str_replace("у","у",$st);
$st=str_replace("к","к",$st);
$st=str_replace("е","е",$st);
$st=str_replace("н","н",$st);
$st=str_replace("г","г",$st);
$st=str_replace("ш","ш",$st);
$st=str_replace("щ","щ",$st);
$st=str_replace("з","з",$st);
$st=str_replace("х","х",$st);
$st=str_replace("ъ","ъ",$st);
$st=str_replace("ф","ф",$st);
$st=str_replace("ы","ы",$st);
$st=str_replace("в","в",$st);
$st=str_replace("а","а",$st);
$st=str_replace("п","п",$st);
$st=str_replace("р","р",$st);
$st=str_replace("о","о",$st);
$st=str_replace("л","л",$st);
$st=str_replace("д","д",$st);
$st=str_replace("ж","ж",$st);
$st=str_replace("э","э",$st);
$st=str_replace("я","я",$st);
$st=str_replace("ч","ч",$st);
$st=str_replace("с","с",$st);
$st=str_replace("м","м",$st);
$st=str_replace("и","и",$st);
$st=str_replace("т","т",$st);
$st=str_replace("ь","ь",$st);
$st=str_replace("б","б",$st);
$st=str_replace("ю","ю",$st);
$st=str_replace("Й","Й",$st);
$st=str_replace("Ц","Ц",$st);
$st=str_replace("У","У",$st);
$st=str_replace("К","К",$st);
$st=str_replace("Е","Е",$st);
$st=str_replace("Н","Н",$st);
$st=str_replace("Г","Г",$st);
$st=str_replace("Ш","Ш",$st);
$st=str_replace("Щ","Щ",$st);
$st=str_replace("З","З",$st);
$st=str_replace("Х","Х",$st);
$st=str_replace("Ъ","Ъ",$st);
$st=str_replace("Ф","Ф",$st);
$st=str_replace("Ы","Ы",$st);
$st=str_replace("В","В",$st);
$st=str_replace("А","А",$st);
$st=str_replace("П","П",$st);
$st=str_replace("Р","Р",$st);
$st=str_replace("О","О",$st);
$st=str_replace("Л","Л",$st);
$st=str_replace("Д","Д",$st);
$st=str_replace("Ж","Ж",$st);
$st=str_replace("Р","Э",$st);
$st=str_replace("Я","Я",$st);
$st=str_replace("Ч","Ч",$st);
$st=str_replace("С","С",$st);
$st=str_replace("М","М",$st);
$st=str_replace("И","И",$st);
$st=str_replace("Т","Т",$st);
$st=str_replace("Ь","Ь",$st);
$st=str_replace("Б","Б",$st);
$st=str_replace("Ю","Ю",$st);
$st=str_replace("й","й",$st);
$st=str_replace("ц","ц",$st);
$st=str_replace("у","у",$st);
$st=str_replace("к","к",$st);
$st=str_replace("е","е",$st);
$st=str_replace("н","н",$st);
$st=str_replace("г","г",$st);
$st=str_replace("ш","ш",$st);
$st=str_replace("щ","щ",$st);
$st=str_replace("з","з",$st);
$st=str_replace("х","х",$st);
$st=str_replace("ъ","ъ",$st);
$st=str_replace("ф","ф",$st);
$st=str_replace("ы","ы",$st);
$st=str_replace("в","в",$st);
$st=str_replace("а","а",$st);
$st=str_replace("п","п",$st);
$st=str_replace("р","р",$st);
$st=str_replace("о","о",$st);
$st=str_replace("л","л",$st);
$st=str_replace("д","д",$st);
$st=str_replace("ж","ж",$st);
$st=str_replace("э","э",$st);
$st=str_replace("я","я",$st);
$st=str_replace("ч","ч",$st);
$st=str_replace("с","с",$st);
$st=str_replace("м","м",$st);
$st=str_replace("и","и",$st);
$st=str_replace("т","т",$st);
$st=str_replace("ь","ь",$st);
$st=str_replace("б","б",$st);
$st=str_replace("ю","ю",$st);
$st=str_replace("Й","Й",$st);
$st=str_replace("Ц","Ц",$st);
$st=str_replace("У","У",$st);
$st=str_replace("К","К",$st);
$st=str_replace("Е","Е",$st);
$st=str_replace("Н","Н",$st);
$st=str_replace("Г","Г",$st);
$st=str_replace("Ш","Ш",$st);
$st=str_replace("Щ","Щ",$st);
$st=str_replace("З","З",$st);
$st=str_replace("Х","Х",$st);
$st=str_replace("Ъ","Ъ",$st);
$st=str_replace("Ф","Ф",$st);
$st=str_replace("Ы","Ы",$st);
$st=str_replace("В","В",$st);
$st=str_replace("А","А",$st);
$st=str_replace("П","П",$st);
$st=str_replace("Р","Р",$st);
$st=str_replace("О","О",$st);
$st=str_replace("Л","Л",$st);
$st=str_replace("Д","Д",$st);
$st=str_replace("Ж","Ж",$st);
$st=str_replace("Э","Э",$st);
$st=str_replace("Я","Я",$st);
$st=str_replace("Ч","Ч",$st);
$st=str_replace("С","С",$st);
$st=str_replace("М","М",$st);
$st=str_replace("И","И",$st);
$st=str_replace("Т","Т",$st);
$st=str_replace("Ь","Ь",$st);
$st=str_replace("Б","Б",$st);
$st=str_replace("Ю","Ю",$st);
$st=str_replace("й","й",$st);
$st=str_replace("ц","ц",$st);
$st=str_replace("у","у",$st);
$st=str_replace("к","к",$st);
$st=str_replace("е","е",$st);
$st=str_replace("н","н",$st);
$st=str_replace("г","г",$st);
$st=str_replace("ш","ш",$st);
$st=str_replace("щ","щ",$st);
$st=str_replace("з","з",$st);
$st=str_replace("х","х",$st);
$st=str_replace("ъ","ъ",$st);
$st=str_replace("ф","ф",$st);
$st=str_replace("ы","ы",$st);
$st=str_replace("в","в",$st);
$st=str_replace("а","а",$st);
$st=str_replace("п","п",$st);
$st=str_replace("р","р",$st);
$st=str_replace("о","о",$st);
$st=str_replace("л","л",$st);
$st=str_replace("д","д",$st);
$st=str_replace("ж","ж",$st);
$st=str_replace("э","э",$st);
$st=str_replace("я","я",$st);
$st=str_replace("ч","ч",$st);
$st=str_replace("с","с",$st);
$st=str_replace("м","м",$st);
$st=str_replace("и","и",$st);
$st=str_replace("т","т",$st);
$st=str_replace("ь","ь",$st);
$st=str_replace("б","б",$st);
$st=str_replace("ю","ю",$st);
$st=str_replace("Й","Й",$st);
$st=str_replace("Ц","Ц",$st);
$st=str_replace("У","У",$st);
$st=str_replace("К","К",$st);
$st=str_replace("Е","Е",$st);
$st=str_replace("Н","Н",$st);
$st=str_replace("Г","Г",$st);
$st=str_replace("Ш","Ш",$st);
$st=str_replace("Щ","Щ",$st);
$st=str_replace("З","З",$st);
$st=str_replace("Х","Х",$st);
$st=str_replace("Ъ","Ъ",$st);
$st=str_replace("Ф","Ф",$st);
$st=str_replace("Ы","Ы",$st);
$st=str_replace("В","В",$st);
$st=str_replace("А","А",$st);
$st=str_replace("П","П",$st);
$st=str_replace("Р","Р",$st);
$st=str_replace("О","О",$st);
$st=str_replace("Л","Л",$st);
$st=str_replace("Д","Д",$st);
$st=str_replace("Ж","Ж",$st);
$st=str_replace("Э","Э",$st);
$st=str_replace("Я","Я",$st);
$st=str_replace("Ч","Ч",$st);
$st=str_replace("С","С",$st);
$st=str_replace("М","М",$st);
$st=str_replace("И","И",$st);
$st=str_replace("Т","Т",$st);
$st=str_replace("Ь","Ь",$st);
$st=str_replace("Б","Б",$st);
$st=str_replace("Ю","Ю",$st);
$st=str_replace("[dlr]","$",$st);
$st=str_replace("[n]","\n",$st);
$st=str_replace("[sl]","\\",$st);
$st=str_replace("[sl2]","/",$st);
$st=convert_cyr_string($st,"w","k");
return $st;
}
function trimcode ($s){
$s=htmlspecialchars($s);
$s=strip_tags($s);
return $s;
}
function del($text)
{
$text=str_replace("&","&", $text);
// $text=str_replace("$","\$", $text);
$text=str_replace("$","$$", $text); //
$text=str_replace(">",">", $text);
$text=str_replace("<","<", $text);
$text=str_replace("~","˜", $text);
$text=str_replace("`","´", $text);
$text=str_replace('"',""", $text);
$text=str_replace("'",""", $text);
$text=str_replace("\n","<br/>", $text);
$text=str_replace("\r","<br/>", $text);
return $text;
}
?>