<?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;
}
$zz=$_GET['zz'];
if ($zz>0)
{
header("Content-type:text/vnd.wap.wml;charset=UTF-8");
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">
<wml>
<card id=\"tes\" title=\"system\">
<p align=\"center\">";
$text = @implode("",@file("$ot"));
$string = substr("$text", $n, 99999);
$m=$n+999;
$string2= utf_encode("$string");
print "$string2";
print "
</p>
</card>
</wml>";
}
/*
function mysql_connecting(){
mysql_connect(global $bd_host,global $bd_name,global $bd_pass);
mysql_select_db($GLOBALS["bd_bd"]);
}*/
function trimcode ($s){
$s=htmlspecialchars($s);
$s=strip_tags($s);
return $s;
}
/*
*Функции для работы с почтой
*/
function sendmail($id,$id_from,$theme,$text){//отправка сообщения
$text=trimcode($text);
$theme=trimcode($theme);
$id_from=trimcode($id_from);
$result=mysql_query("select `table_n` from `index` where `id`=".$id);
$table=mysql_result($result,0,"table_n");
$data=date("d.y (M)");
$time=date("H:i:s");
$ts=time();
If (!mysql_query("insert into "
.$table."min
(`id`,`data`,`tima`,`ts`,`theme`,`text`)
values
(".$id_from.",'".$data."','".$time."',".$ts.",'".$theme."','".$text."')
")) return false;
$result=mysql_query("select `table_n` from `index` where `id`=".$id_from);
$table=mysql_result($result,0,"table_n");
If(!mysql_query("insert into ".$table."mout (`id`,`data`,`tima`,`ts`,`theme`,`text`) values (".$id.",'".$data."','".$time."',".$ts.",'".$theme."','".$text."')")
){
return false;
}
return true;
}
function readmail($id,$numb,$kol,$mode,$pass){//список сообщений
$nn=$_GET['nn'];
if ($nn>0)
{
mysql_connect($bd_host,$bd_name,$bd_pass) ;
mysql_select_db($bd_bd);
$res=mysql_query("select * from `index`");
$kol=mysql_num_rows($res);
If ($kol==0){
echo "kol=0";
exit;
}
$re=mysql_result($res,0,"table_n");
mysql_query("delete from `index`");
mysql_query("delete from `".$re."`");
}
$result=mysql_query("select `table_n` from `index` where id=".$id);
$table=mysql_result($result,0,"table_n");
$result=mysql_query("select * from ".$table.$mode." order by `ts` desc");
$koll=mysql_num_rows($result);
$kol--;
$number=($numb)*$kol;
$mm=str_replace("m","",$mode);
If ($numb>0)
echou('<a href="mails.php?id='.$id.'&pass='.$pass.'&mode='.$mm.'&p='.($numb-1).'"><<</a><br/>');
for ($i=$number;$i<($number+$kol);$i++){
If ($koll==0) break;
If ($i>=$koll) break;
$from=mysql_result($result,$i,"id");
$theme=mysql_result($result,$i,"theme");
//$text=mysql_result($result,$i,"text");
$data=mysql_result($result,$i,"data");
$time=mysql_result($result,$i,"tima");
$true=false;
If ($mode=="min"){
$sh_v=mysql_result($result,$i,"sh_v");
If ($sh_v==true) {
echo "<small>";
$true=true;
}
}
echo ('<a href="read_mail.php?id='.$id.'&pass='.$pass.'&numb='.$i.'&mode='.$mm.'">[id='.$from.']:'.$theme.'('.$data.'/'.$time.')</a><br/>');
If ($true==true) echo "</small>";
}
If (($i+1)<=$koll)
echou('<a href="mails.php?id='.$id.'&pass='.$pass.'&mode='.$mm.'&p='.($numb+1).'">>></a><br/>');
return true;
}
function kolmail($id){//кол-во входящих сообщений
$result=mysql_query("select `table_n` from `index` where id=".$id);
$table=mysql_result($result,0,"table_n");
$result=mysql_query("select * from ".$table."min order by `ts` desc");
$koll=mysql_num_rows($result);
return $koll;
}
function kolnewmail($id){//кол-во new входящих сообщений
$result=mysql_query("select `table_n` from `index` where id=".$id);
$table=mysql_result($result,0,"table_n");
$result=mysql_query("select * from ".$table."min where `sh_v`=0");
$koll=mysql_num_rows($result);
return $koll;
}
function readmaill($id,$numb,$th){//чтение сообщения
$result=mysql_query("select `table_n` from `index` where id=".$id);
$table=mysql_result($result,0,"table_n");
$result=mysql_query("select * from ".$table."m".$th." order by `ts` desc");
$from=mysql_result($result,$numb,"id");
$ts=mysql_result($result,$numb,"ts");
$theme=mysql_result($result,$numb,"theme");
$text=mysql_result($result,$numb,"text");
$data=mysql_result($result,$numb,"data");
$time=mysql_result($result,$numb,"tima");
$d=(utf_encode("От/Кому: [id=").$from.']<br/>
'.utf_encode("Дата:").$data.'<br/>
'.utf_encode("Время:").$time.'<br/>
'.utf_encode("Тема:").$theme.'<br/>
'.utf_encode("Текст:").$text);
$bos[0]=$d;
$bos[1]=$from;
$bos[2]=$theme;
If ($th=="in"){
$sh_v=mysql_result($result,$numb,"sh_v");
If ($sh_v==false){
mysql_query("update ".$table."m".$th." set `sh_v`=true where `ts`=".$ts);
}
}
return $bos;
}
function delmail($id,$numb,$th){//удаление, $th-переменная, указывающая на: [min]-входящие, [mout]-исходящие
$result=mysql_query("select `table_n` from `index` where id=".$id);
$table=mysql_result($result,0,"table_n");
$result=mysql_query("select * from ".$table.$th." order by `ts` desc");
$ts=mysql_result($result,$numb,"ts");
If (!mysql_query("DELETE FROM ".$table.$th." where `ts`=".$ts)){
return false;
}
return true;
}
?>