<?
if(!$_SESSION['ID_Glob']) exit();
$id_spisok=$_SESSION['ses_s']['id_spisok'];
if($id_spisok)
	{
	ob_start();

	echo "<?\n";

	$result = mysql_query("SELECT * FROM element WHERE id_spisok = '".$id_spisok."'");
	while($r_result=mysql_fetch_array($result)) 
		{
		$result2 = mysql_query("SELECT * FROM element_two WHERE id_element = '".$r_result['id_element']."' ORDER BY num, element_two");
		while($r_result2=mysql_fetch_array($result2)) 
			{
			echo '$arr_element_two['.$r_result2['id_element'].']['.$r_result2['id_element_two'].']=\''.$r_result2['element_two'].'\';';
			echo "\n";
			}
		} 
	echo "?>";

	$buf = ob_get_contents();
	ob_end_clean();

	file_put_contents("../cashe_n/_svod_element_two_".$id_spisok.".php", $buf);
/*
$file1 = fopen ("../cashe_n/_svod_element_two_".$id_spisok.".php", "w");
flock($file1, LOCK_EX);
fputs($file1, $buf);
fclose($file1);
*/
	}
?>
