Файл: chat/pizdun.php
Строк: 42
<?php
function bot($text) {
$bot_text = '';
//текст приветствия
$_hello = mysql_fetch_array(mysql_query("SELECT message FROM dialog WHERE type = 'hello' ORDER BY RAND() DESC LIMIT 1"));
$hello_text[] = $_hello[0];
//ответы на вопросы
$_quest = mysql_fetch_array(mysql_query("SELECT message FROM dialog WHERE type = 'quest' ORDER BY RAND() DESC LIMIT 1"));
$quest_text[] = $_quest[0];
//отвечаем на обзывания
$_mat = mysql_fetch_array(mysql_query("SELECT message FROM dialog WHERE type = 'mat' ORDER BY RAND() DESC LIMIT 1"));
$mat_text[] = $_mat[0];
//отвечаем на намеки об искуственном происхождении
$_robot = mysql_fetch_array(mysql_query("SELECT message FROM dialog WHERE type = 'robot' ORDER BY RAND() DESC LIMIT 1"));
$robot_text[] = $_robot[0];
//про лубоф
$_love = mysql_fetch_array(mysql_query("SELECT message FROM dialog WHERE type = 'love' ORDER BY RAND() DESC LIMIT 1"));
$love_text[] = $_love[0];
//предложения поговорить
$_talk = mysql_fetch_array(mysql_query("SELECT message FROM dialog WHERE type = 'talk' ORDER BY RAND() DESC LIMIT 1"));
$talk_text[] = $_talk[0];
//как зовут
$_name = mysql_fetch_array(mysql_query("SELECT message FROM dialog WHERE type = 'name' ORDER BY RAND() DESC LIMIT 1"));
$name_text[] = $_name[0];
//Спасибо
$_sps = mysql_fetch_array(mysql_query("SELECT message FROM dialog WHERE type = 'sps' ORDER BY RAND() DESC LIMIT 1"));
$sps_text[] = $_sps[0];
if (preg_match('(салам|салют|ривет|даров|рям|авствуй|чмак|рива|драсти|хай|Хай)', $text))
{
$rand = mt_rand(0, count($hello_text) - 1);
$bot_text .= ' ' . $hello_text[$rand];
$e1 = true;
}
if (preg_match('(елаешь|где|что|че|чё|чем|чему|как|огда|кто|тветь|твечай|колько|акой|акая|акие|уда|елай|(.*?)?)', $text))
{
$rand = mt_rand(0, count($quest_text) - 1);
$bot_text .= ' ' . $quest_text[$rand];
$e2 = true;
}
if (preg_match('(удак|изда|бля|издец|тупой|ебок|ебать|еби|соси|издуй|овно|ерьмо|урак|лупый)', $text))
{
$rand = mt_rand(0, count($mat_text) - 1);
$bot_text .= ' ' . $mat_text[$rand];
$e3 = true;
}
if (preg_match('(бот|нео|иборг)', $text))
{
$rand = mt_rand(0,count($robot_text) - 1);
$bot_text .= ' ' . $robot_text[$rand];
$e4 = true;
}
if (preg_match('(люби|любл)', $text))
{
$rand = mt_rand(0,count($love_text) - 1);
$bot_text .= ' ' . $love_text[$rand];
$e5 = true;
}
if (preg_match('(оговор|скажи|сказ|овори)', $text))
{
$rand = mt_rand(0, count($talk_text) - 1);
$bot_text .= ' ' . $talk_text[$rand];
$e6 = true;
}
if (preg_match('(имя|зовут|звать)', $text))
{
$rand = mt_rand(0, count($name_text) - 1);
$bot_text .= ' ' . $name_text[$rand];
$e7 = true;
}
if (preg_match('(спс|сибо|сиба|спас)', $text))
{
$rand = mt_rand(0, count($sps_text) - 1);
$bot_text .= ' ' . $sps_text[$rand];
$e8 = true;
}
if (preg_match('(Время|время|Часов|Минут|часов|минут)', $text))
{
$bot_text .= 'Текущее время: ' . date('H:i:s');
$e9 = true;
}
if (isset($e1) || isset($e2) || isset($e3) || isset($e4) || isset($e5) || isset($e6) || isset($e7) || isset($e8) || isset($e9)) {
if (isset($_POST['komu']) && !empty($text)) {
$bot_text = $bot_text;
}
} else {
$_sql = mysql_fetch_array(mysql_query("SELECT `message` FROM `dialog` WHERE `type` = 'fuck' ORDER BY RAND() DESC LIMIT 1"));
$bot_text = $_sql[0];
}
return $bot_text;
}
?>