<?php	
include "config.php";
		$sql = mysql_query("SELECT id FROM `users`");
		while ($user=mysql_fetch_array($sql)){
				$sql1=mysql_query("SELECT * FROM `komplekt` where owner=".$user['id']);
				if (mysql_num_rows($sql1)>0)
				while ($komp=mysql_fetch_array($sql1)){
					//Сохраняем комплект
					$dir="/tmp/memcache/komplekt/".$user['id'];
					if (!file_exists($dir)) mkdir($dir);
					$f=fopen($dir."/".$komp['name'].".txt","w+");
					$odetShmot=mysql_query("select name from inventory where id=".$komp['sergi']." or id=".$komp['kulon']." or id=".$komp['perchi']." or id=".
								$komp['weap']." or id=".$komp['bron']." or id=".$komp['r1']." or id=".$komp['r2']." or id=".$komp['r3']." or id=".
								$komp['helm']." or id=".$komp['shit']." or id=".$komp['m1']." or id=".$komp['m2']." or id=".$komp['m3']." or id=".$komp['m4'].
								" or id=".$komp['m5']." or id=".$komp['m6']." or id=".$komp['m7']." or id=".$komp['m8']." or id=".$komp['m9']." or id=".$komp['m10'].
								" or id=".$komp['boots']);
					while ($res=mysql_fetch_row($odetShmot)){
						fwrite($f,$res[0]."\n");
					}	
					fclose($f);
				}
		}
	//http://old-dark.ru/perenoskomplekta.php	
	
	echo "заливаем на продакшн";
?>