<?php

	$dane_do_pliku = "<?php\n"; 
	
	$sql = mysql_query("SELECT nazwa_pliku FROM ".$db_pref."modul WHERE stan='1' and id_serwisu='".$ID_serwisu."';");
	while($row = mysql_fetch_array($sql)){
		$dane_do_pliku .= 'include "mod/inc/'.$row['nazwa_pliku'].'";'."\n";
	}

	$dane_do_pliku .= "?>"; 

	$file = $_SERVER['DOCUMENT_ROOT'].'/include/moduly.php'; 
	$fp = fopen($file, "w"); 
	flock($fp, 2); 
	fwrite($fp, $dane_do_pliku); 
	flock($fp, 3); 
	fclose($fp); 

?>