<?
// Данные от базы данных


if(!($db=@mysql_connect('localhost', 'db1466694602', '123456')))
{
echo "<center>Sorry, at the moment there is a technical work</center>";
exit;
}

// подключение к базе
if (!@mysql_select_db('db1466694602',$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);
if(!isset($_SESSION))
{
session_name('SESS');
session_start();
$sess=mysql_escape_string(session_id());
if (!preg_match('#[A-z0-9]{32}#i',$sess))$sess=md5(rand(09009,999999));
}


if(isset($_COOKIE['id']) && isset($_COOKIE['pass']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE  `id` = '".($_COOKIE['id'])."' AND `password` = '".($_COOKIE['pass'])."'"),0)!=0) {
$ku = mysql_fetch_assoc(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '".($_COOKIE['id'])."' AND `password` = '".($_COOKIE['pass'])."' LIMIT 1"));
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_setting` WHERE `id_user` = '$ku[id]' LIMIT 1"),0)==0)mysql_query("INSERT INTO `kolhoz_setting` SET `id_user` = '$ku[id]'") or die (mysql_error());
$conf=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_setting` WHERE `id_user` = '$ku[id]'"));
}
$set=array();
$set['p_str']=10;
$q=mysql_query("SELECT * FROM `kolhoz_config`") or die (mysql_error());
While($row=mysql_fetch_array($q))
{
$set[$row[1]]=$row[2];
}
?>