<?
if(!$_SESSION['ID_Glob']) exit();
$id_spisok=$_SESSION['ses_s']['id_spisok'];
if($id_spisok)
	{
	ob_start();
	$dsp=mysql_query("SELECT * FROM spisok WHERE id_spisok = '".$id_spisok."'");
	$r_dsp=mysql_fetch_array($dsp);
	$ch=$r_dsp['ch'];

	echo "<?\n";

	$result = mysql_query("SELECT * FROM element WHERE id_spisok = '".$id_spisok."' ORDER BY num, element");
	while($r_result=mysql_fetch_array($result)) 
		{
		echo '$arr_element['.$r_result['id_spisok'].']['.$r_result['id_element'].']=\''.$r_result['element'].'\';';
		echo "\n";
		if($r_result['color_fon'] && $r_result['color_text'])
			{
			echo '$arr_element_fon['.$r_result['id_spisok'].']['.$r_result['id_element'].']=\''.$r_result['color_fon'].'\';';
			echo "\n";
			echo '$arr_element_text['.$r_result['id_spisok'].']['.$r_result['id_element'].']=\''.$r_result['color_text'].'\';';
			echo "\n";
			}
		} 
	echo "?>";

	$buf = ob_get_contents();
	ob_end_clean();

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