<?

/*
Автор скрипта https://bymas.ru/id85823
Скрипты, программы на заказ.
Быстро, качественно, недорого.
*/

include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
#include_once '../sys/inc/user.php';

$imitation = mysql_fetch_assoc(mysql_query("SELECT * FROM `imitation` WHERE `id` = '1' LIMIT 1"));

if ($imitation['working'] == 0) exit;

$base = mysql_fetch_assoc(mysql_query("SELECT * FROM `base` ORDER BY rand() DESC LIMIT 1"));
$visitor = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` where date_last > '".(time()-600)."' ORDER BY rand() DESC LIMIT 1"));
$adding = time() + rand(1, 60);

$u = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` where imitation = 1 ORDER BY rand() DESC LIMIT 1"));

$probability = rand(1, 5);

if ($probability == 1) {
    
    mysql_query("INSERT INTO `status` (`id_user`, `time`, `msg`, `pokaz`) VALUES ('$u[id]', '$adding', '$base[i]', '1')");
    
}elseif ($probability == 2) {
    
    mysql_query("INSERT INTO `guest` (`id_user`, `time`, `msg`) VALUES ('$u[id]', '$adding', '$base[i]')");
    
}elseif ($probability == 3) {
    
    mysql_query("INSERT INTO `chat_post` (`room`, `id_user`, `time`, `msg`, `privat`) VALUES ('$imitation[chat_post]', '$u[id]', '$adding', '$base[i]', '0')");
    
}elseif ($probability == 4) {
    
    mysql_query("INSERT INTO `forum_p` (`id_forum`, `id_razdel`, `id_them`, `id_user`, `time`, `msg`) VALUES ('$imitation[id_forum]', '$imitation[id_razdel]', '$imitation[id_them]', '$u[id]', '$adding', '$base[i]')");
    
}elseif ($probability == 5) {
    
    mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('$u[id]', '$visitor[id]', '$base[i]', '$adding')");
    
}

$array = array(
'/online.php',
'/info.php',
'/new_mess.php',
'/index.php',
'/konts.php');

$url = array_rand($array, 2);

mysql_query("INSERT INTO `my_guests` (`id_ank`, `id_user`, `time`) values('$visitor[id]', '$u[id]', '$adding')");

mysql_query("UPDATE `user` SET `date_last` = '".time()."', `url` = '".$array[$url[0]]."' WHERE `id` = '$u[id]'");