<?
// Данные от базы данных
$sot_db_host='localhost'; // хост
$sot_db_user_name='valfe201_ferma'; // имя пользователя
$sot_db_password='paifeM9dohbid1o'; // пароль
$sot_db_name='valfe201_ferma'; // имя базы данных

if(!($db=@mysql_connect($sot_db_host, $sot_db_user_name, $sot_db_password))){
header("Location:/404.php");
exit;
}

// подключение к базе
if (!@mysql_select_db($sot_db_name,$db)){
echo "Wrong MySQL db name";
exit;
}

mysql_query('set charset utf8',$db); 
mysql_query('SET names utf8',$db); 
mysql_query('set character_set_client="utf8"',$db); 
mysql_query('set character_set_connection="utf8"',$db); 
mysql_query('set character_set_result="utf8"',$db);

$log_sql = '11492';
$_SESSION['sql_log'] = array();

function mysql_querll($sql){
global $log_sql;
$_SESSION['sql_number']++;
$tim = microtime(true);
$rez = mysql_query($sql);
$time_sql = microtime(true) - $tim;
$_SESSION['sql_time'] += $time_sql;
if($_SESSION['id_user'] == $log_sql){array_push($_SESSION['sql_log'],((round($time_sql, 3)*1000).' ms - '.$sql));}
return $rez;
}

// `search_accelerator`="'.$_SESSION['search_accelerator'].'" and 
$system_data = mysql_fetch_assoc(mysql_querll('SELECT * FROM `kolhoz_system` WHERE `id`="1"'));
$ku = mysql_fetch_assoc(mysql_querll('SELECT * FROM `kolhoz_user` WHERE `id`="'.$_SESSION['id_user'].'"'));
if($ku['id']==''){$ku = null;}

$set['p_str']=10;
?>