<?
  ##########################################
## Àâòîð: -=ØÀÕÒÅÐ=-                        #                                                                                                                                                                                      ## Ñàéò: http://masteram.us                 #                 															                      ## ICQ  :  46-92-90                         #                 														 		           ## Âåðñèÿ 4.0 Ëèöåíçèîííàÿ                  #
## Äàííàÿ âåðñèÿ ñêðèïòà ÿâëÿåòñÿ ÏËÀÒÍÎÉ,  #
## âû ÍÅ ÈÌÅÅÒÅ ÏÐÀÂÀ ðàñïðîñòðÿíÿòü äàííûé #
##  ñêðèïò èëè êàêèå-ëèáî ÷àñòè åãî êîäà... #
  #########################################
$intervzan = $set['anektime'];

$printanan=0;
$ban = $db->sql_fetchrow($db->sql_query ("Select anek from botst where id='1'"));
$andata = $ban['anek'];
if ($andata < $time){
$andata = $time + $intervzan;
$db->sql_query ("Update botst set anek='".$andata."' where id='1'");
$printanan=1;
}

if($printanan==1){
$a = $db->sql_fetchrow($db->sql_query("select count(ids) as num from anekdot"));
$rnd = rand(1,$a["num"]);
$b = $db->sql_fetchrow($db->sql_query ("SELECT * FROM anekdot WHERE ids = '".$rnd."' LIMIT 1;"));

$messs = "".$b["message"]."";

$a_post=$db->sql_fetchfield($db->sql_query("select COUNT(*) from rooms WHERE `anek` != '0';"),0);
$k_page=k_page($a_post,$a_post);
$page=page($k_page);
$a1=$a_post*$page-$a_post;

$num = @$db->sql_query("SELECT * from rooms WHERE `anek` != '0' order by rm DESC limit $a1, $a_post;" );
while($nums = @$db->sql_fetchrow($num)){
$db->sql_query ("INSERT INTO message (user,user_id,time,msg,rm) VALUES ('$user_anek','0','$time','$messs','$nums[rm]')");
}

}
?>